Silent mode execution with java.exe

蓝咒 提交于 2019-12-30 04:31:05

问题


I would like to know if there is a way to execute the "java.exe" as a background process (silent mode execution)

Ex: java -cp . MyClass arg1

I want to run the above statement as a background process , without opening command window


回答1:


Under Windows, use javaw.exe instead of java.exe. See here for link, relevant bit copied here:

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.




回答2:


Use

javaw -cp . MyClass arg1

(assuming you're on MS windows)

If you're looking at services rather then applications then have a look at 'service wrappers'



来源:https://stackoverflow.com/questions/2902656/silent-mode-execution-with-java-exe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!