C#调用jar示例

public static void Encrypt()
{
    //进程启动信息
    ProcessStartInfo startInfo = new ProcessStartInfo()
    {
        UseShellExecute = false,
        CreateNoWindow = true,
        //RedirectStandardOutput = true,
        WindowStyle = ProcessWindowStyle.Hidden,
        FileName = "java.exe",
        Arguments = @"-jar F:\test\encrypt.jar F:\test\old.apk F:\test\new.apk"
    };
    //启动进程
    using (Process process = Process.Start(startInfo))
    {
        process.WaitForExit();
    }
}

说明:不能设置RedirectStandardOutput=true,否则C#程序会一直停在这个操作不能退出。

评论: 0 | 引用: 0 | 查看次数: 4699
发表评论
登录后再发表评论!