我試圖用這個代碼啓動Java程序的Java程序時:錯誤啓動從C#
ProcessStartInfo info = new ProcessStartInfo();
info.WorkingDirectory = @"D:\2\server";
info.FileName = "java";
info.Arguments = "-Xms512m -Xmx1536m -Xbootclasspath/p:./libs/jsr166.jar -cp ./libs/*;server.jar server.Server";
ServerProcess = new Process();
ServerProcess.StartInfo = info;
ServerProcess.Start();
但總是收到錯誤:
Error occurred during initialization of VM Could not reserve enough space for object heap Could not create the Java virtual machine.
但是,如果我創建代碼.bat文件:
java -Xms512m -Xmx1536m -Xbootclasspath/p:./libs/jsr166.jar -cp ./libs/*;server.jar server.Server
- 一切OK!
所以我想我的C#代碼有問題嗎?
謝謝!
可能會嘗試刪除「FileName」並添加「java內部參數? – kosa
也許您的C#應用程序佔用大量內存? – nullpotent
不,啓動一切正常,使用此啓動程序Java應用程序的問題,看起來像這個啓動程序作品有點孤立 – Robert