从.NET(System.Diagnostics.Process)执行编译的jar文件 [英] Executing compiled jar file from .NET (System.Diagnostics.Process)

查看:217
本文介绍了从.NET(System.Diagnostics.Process)执行编译的jar文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试将Google Closure编译器集成到我的批处理作业中,并且无法正常工作。

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 -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.

我尝试过

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")

我做错了什么? / p>

What am I doing wrong?

推荐答案

参数应为

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

ie

还要设置

process.StartInfo.FileName = "java"

EDIT

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

这篇关于从.NET(System.Diagnostics.Process)执行编译的jar文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆