简体   繁体   English

java.io.IOException:无法运行程序“ tskill”:CreateProcess错误= 2,系统找不到指定的文件

[英]java.io.IOException: Cannot run program “tskill”: CreateProcess error=2, The system cannot find the file specified

I'm trying to run a Java program that runs the tskill Windows command, but im getting the exception listed in the title. 我正在尝试运行一个运行tskill Windows命令的Java程序,但是我收到标题中列出的异常。 tskill is on the path when I run it from the command prompt. 在命令提示符下运行tskill时,它位于路径上。 I'm running this program as a Java Application in Eclipse. 我正在以Eclipse中的Java应用程序形式运行该程序。 I added c:\\windows\\system32 to the Path in eclipse, but the java program still can't find it. 我在Eclipse的Path中添加了c:\\ windows \\ system32,但是java程序仍然找不到它。 How do I fix this? 我该如何解决? How can I determine what path is set to in the java program? 如何确定Java程序中设置的路径?

    try {
        RunProcess.doExecuteCommand("tskill winword /A");
        Thread.sleep(1000);
    } catch (Throwable t) {
        throw new GenerationException(t);
    }
}

Try this 尝试这个

try {
    Runtime rt = Runtime.getRuntime();
    rt.exec("tskill winword /A");
} catch (Throwable t) {
    t.printStackTrace();
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 java.io.IOException:无法运行程序“mysql”:CreateProcess error=2,系统找不到指定的文件 - java.io.IOException:Cannot run program “mysql”:CreateProcess error=2, The system cannot find the file specified java.io.IOException:无法运行程序“”:CreateProcess error = 2,系统找不到指定的文件 - java.io.IOException: Cannot run program “”: CreateProcess error=2, The system cannot find the file specified java.io.IOException:无法运行程序“ WMIC”:CreateProcess错误= 2,系统找不到指定的文件 - java.io.IOException: Cannot run program “WMIC”: CreateProcess error=2, The system cannot find the file specified java.io.IOException:无法运行程序“plink”:CreateProcess error=2,系统找不到指定的文件 - java.io.IOException: Cannot run program "plink": CreateProcess error=2, The system cannot find the file specified java.io.IOException:无法运行程序“sqlldr”:CreateProcess error = 2,系统找不到指定的文件 - java.io.IOException: Cannot run program “sqlldr”: CreateProcess error=2, The system cannot find the file specified java.io.IOException:无法运行程序“。\\ bin \\ catalina.bat”-CreateProcess错误= 2,系统找不到指定的文件 - java.io.IOException: Cannot run program “.\bin\catalina.bat” - CreateProcess error=2, The system cannot find the file specified e:java.io.IOException:无法运行程序“ java -jar bg.jar”:CreateProcess错误= 2,系统找不到文件 - e: java.io.IOException: Cannot run program “java -jar bg.jar”: CreateProcess error=2, The system cannot find the file java.io.IOException:Cannot run program "sh" (in directory "c:\\cygwin\\bin\\test"):CreateProcess error=2.The system cannot find file specified - java.io.IOException:Cannot run program “sh” (in directory“c:\cygwin\bin\test”):CreateProcess error=2.The system cannot find file specified 可能的原因java.io.IOException:CreateProcess错误= 2,系统找不到指定的文件 - Possible cause java.io.IOException: CreateProcess error=2, The system cannot find the file specified 引起:java.io.IOException:CreateProcess error = 2,系统找不到AWS指定的文件 - Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified with AWS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM