Here's my code:
string ex = "java -jar \"" + Settings.ClosureCompilerJarLocation + "\" --js \"" + C2runtimePath + "\" --js_output_file \"" + C2runtimeCompiledPath + "\" --language_in ECMASCRIPT5_STRICT --compilation_level ADVANCED_OPTIMIZATIONS --externs \"" + Settings.C2ExternsFolderLocation + "jquery-externs.js\" --externs \"" + Settings.C2ExternsFolderLocation + "c2-externs.js\"";
System.Diagnostics.Process.Start("CMD.exe", ex);
And an example of ex
printed just before it executes:
java -jar "C:\inetpub\wwwroot\ScirraNew\static\ac\closure-compiler\compiler.jar" --js "C:\inetpub\wwwroot\arcade\games\46/c2runtime.js" --js_output_file "C:\inetpub\wwwroot\arcade\games\46/c2runtime_COMPILED.js" --language_in ECMASCRIPT5_STRICT --compilation_level ADVANCED_OPTIMIZATIONS --externs "C:\inetpub\wwwroot\ScirraNew\static\ac\templates\jquery-externs.js" --externs "C:\inetpub\wwwroot\ScirraNew\static\ac\templates\c2-externs.js"
- It doesn't throw any errors and doesn't complete the command
- If I copy + paste the command into cmd.exe myself it runs just fine
You should execute
java.exe
directly, with the desired arguments.Passing
cmd.exe
a command line won't do anything.You need to call
WaitForExit()
on the resultantProcess
instance.