我想知道有什么方法可以控制我的 jar 启动过程的名称,即
我在 java 中创建了一个 .jar 文件,每当我点击它时,它都会导致一个名为 javaw.exe 的进程,我想控制这个名称。
我想这样做是因为当我点击我的 jar 文件时,如果它已经在运行它应该停止并且一个新的应该开始,即我想通过停止前一个来运行一个新的线程(进程)每次我点击它.
如果我终止名为 javaw.exe 的进程,则所有名为 javaw.exe 的进程都将终止(如果我正在运行多个程序)。所以,我需要更改它的名称。
请帮助。
谢谢!
最佳答案
javaw
运行没有问题。 From the documentation :
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.
最终,javaw
在没有控制台窗口的情况下运行您的程序。更改该名称可能会在以后导致一些严重的问题,因此您希望保留该特定程序名称。
关于java - 控制我的 jar 的进程名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14555425/