windows 如何从 .bat 脚本在单独的窗口中启动 JAR?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5743871/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to start JAR in separate window from a .bat script?
提问by a_horse_with_no_name
I need to start a jar file with a *.bat file so that as it executes the Java command, it detaches from the terminal window (command prompt) and does not block the rest of the script. Is this possible? If so, how?
我需要用 *.bat 文件启动一个 jar 文件,以便在它执行 Java 命令时,它与终端窗口(命令提示符)分离并且不会阻止脚本的其余部分。这可能吗?如果是这样,如何?
Thanks!
谢谢!
回答by a_horse_with_no_name
java.exe will always display a terminal window, you need to use javaw.exe instead:
java.exe 将始终显示一个终端窗口,您需要使用 javaw.exe 代替:
start javaw -jar myjarfile.jar
回答by Adam Paynter
start /B java -jar myjarfile.jar