欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

windows下无DOS窗口运行Java程序的bat文件

程序员文章站 2022-01-20 23:14:37
...
java -jar x.jar

这样话在Java程序启动时,加载的DOS窗口一直出现,直到你关闭了Java程序才一起关闭。

为了避免这个DOS窗口,需要把.bat中的启动命名修改为:

javaw -jar x.jar

解释:

参见http://java.sun.com/javase/6/docs/technotes/tools/windows/java.html

The javaw command is identical to java , except that with javaw there is no associated console window. Use javaw when you don't want a command prompt window to appear. The javaw launcher will, however, display a dialog box with error information if a launch fails for some reason.

相关标签: jar