2011-08-06 42 views

回答

1

你應該填充ProcessStartInfo對象,開始爲您的Java控制檯應用程序的過程中,讀它的輸出:

ProcessStartInfo startInfo = new ProcessStartInfo(); 

// specify the address of your java app 
startInfo.FileName = "JVM_PATH_HERE.EXE"; 

// input for your java app 
startInfo.Arguments = "-jar JAVA_APP_PATH_HERE.exe"; 

// do not show your java app window 
startInfo.WindowStyle = ProcessWindowStyle.Hidden; 

// redirect standart input/output for your needs 
startInfo.RedirectStandardInput = true; 
startInfo.RedirectStandardOutput = true; 

using (Process javaProc = Process.Start(startInfo)) 
{ 
    StreamReader oReader2 = p.StandardOutput; 

    // get results from your java app 
    string javaResults = oReader2.ReadToEnd(); 
    oReader2.Close(); 

    // do whatever your like with results; 
    AnalizeResults(javaResults); 
} 
文件名下
+0

相反JAVA_APP_HERE.EXE的,他或許應該把路徑安裝了JVM,並在Arguments下放置了第一個-jar和他的java可執行文件的位置 – sternr

+0

@sternr更新了答案。謝謝。 – VMAtm

相關問題