Executing compiled jar file from .NET (System.Diagnostics.Process)
Trying to integrate the google closure compiler in a batch job of mine and having difficulty getting it to work.
Using command prompt I can enter the following command and get my scripts compiled. (The command is a self explanatory example)
开发者_JAVA百科java -jar "compiler.jar" --js_output_file="myOutput.min.js" --js="input1.js" --js="input2.js"
I have tried to replicate this using the System.Diagnostics.Process object but thus far have failed.
I have tried
Dim command As String = BuildCommand(CompilationScripts, Me._Output)
Dim process As New Process
process.Start("compiler.jar", command)
And I have tried
Dim command As String = BuildCommand(CompilationScripts, Me._Output)
Dim process As New Process
process.StartInfo.Arguments = command
process.Start("compiler.jar")
And I have tried
Dim command As String = BuildCommand(CompilationScripts, Me._Output)
Dim process As New Process
process.StartInfo.Arguments = command
process.Start("cmd.exe")
What am I doing wrong?
Arguments
should be
-jar "compiler.jar" --js_output_file="myOutput.min.js" --js="input1.js" --js="input2.js"
i.e. no java
keyword here.
Also set
process.StartInfo.FileName = "java"
EDIT
process.StartInfo.RedirectStandardInput = True
process.StartInfo.CreateNoWindow = False
process.StartInfo.UseShellExecute = False
process.StartInfo.FileName = "java"
精彩评论