[ACCEPTED]-How can I give my Java application a unique process name?-windows

Accepted answer
Score: 19

The process name is the name of the JVM. So 3 if you rename the jvm you have an other 2 process name. There are some tools which 1 can do that for you. For example Launch4J

Score: 11

IMO the best option is to choose one of 6 the many open source launchers. They all 5 provide a nicer deployment container than 4 java.exe and a batch file.

I've compiled 3 a list of them after a brief search on google 2 (in no particular order and may not be exhaustive):

(full 1 disclosure: i work on winrun4j)

Score: 8

Not easily. The easiest way (but not nice!) would 6 be to simply copy the java.exe (only 68k 5 on my system, so perhaps practical!)

If you're 4 worried about identifying which java process 3 is which (e.g. is one consuming memory/CPU 2 etc.), use the standard tool jps to identify 1 the Java processes

Score: 5

Netbeans and Eclipse both ship with an .exe 6 file that in turns launches a JVM. The exe 5 itaself probably does nothing after launching 4 the VM. You see the NetBeans javaw.exe in 3 the Task Manager also, I suspect.

So you'll 2 need to write a native exe (using some windows 1 tool) that does a similar thing.

Score: 1

Just answered this a second ago here: Get JVM to grow memory demand as needed up to size of VM limit?

It's 3 actually a lot easier than folks are saying 2 (but you do have to have a c/c++ compiler 1 handy).

Score: 1

There are mainly 2 approaches: one is as 11 already described: using tools like Launch4j, WinRun4J 10 to create native Windows launchers.

Another 9 approach that seems better is to use Apache 8 Procrun to wrap the java application as 7 a Windows service. During the install service 6 process, we can give the process an meaningful 5 name such as OurApp.exe.

All we need do 4 is rename prunsrv.exe to OurApp.exe and 3 replace every occurrence of prunsrv.exe 2 in our install|start|stop|uninstall service 1 scripts to MyApp.exe.

See more from Using Apache Procrun to Rename Process Name of a Java Program in Windows

More Related questions