2011-02-08 28 views
0

試圖將google閉包編譯器集成到我的批處理作業中,並難以使其工作。從.NET執行編譯的jar文件(System.Diagnostics.Process)

使用命令提示符我可以輸入以下命令並獲取我的腳本編譯。 (該命令是一個自我解釋的例子)

java -jar "compiler.jar" --js_output_file="myOutput.min.js" --js="input1.js" --js="input2.js" 

我試圖複製這使用System.Diagnostics.Process對象,但迄今失敗。

我已經試過

Dim command As String = BuildCommand(CompilationScripts, Me._Output) 
Dim process As New Process 
process.Start("compiler.jar", command) 

我試圖

Dim command As String = BuildCommand(CompilationScripts, Me._Output) 
Dim process As New Process 
process.StartInfo.Arguments = command 
process.Start("compiler.jar") 

我試圖

Dim command As String = BuildCommand(CompilationScripts, Me._Output) 
Dim process As New Process 
process.StartInfo.Arguments = command 
process.Start("cmd.exe") 

我在做什麼錯?

+1

「......都失敗了」。 [如何](http://www.chiark.greenend.org.uk/~sgtatham/bugs.html)? – 2011-02-08 05:51:36

+0

抱歉應該更具體。命令提示符啓動但不採取任何操作。 – 2011-02-08 05:52:35

回答

0

Arguments應該

-jar "compiler.jar" --js_output_file="myOutput.min.js" --js="input1.js" --js="input2.js" 

即在這裏沒有java關鍵字。

還設置

process.StartInfo.FileName = "java" 

編輯

process.StartInfo.RedirectStandardInput = True 
process.StartInfo.CreateNoWindow = False 
process.StartInfo.UseShellExecute = False 
process.StartInfo.FileName = "java"