Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I give my Java application a unique process name?

Tags:

I've noticed that when I start Netbeans it shows up in the task manager as netbeans.exe as all my own Java applications show up as java.exe or javaw.exe.

How can I change that so my process names shows up as myapp.exe?

like image 975
Daniel Rikowski Avatar asked Jul 20 '09 08:07

Daniel Rikowski


3 Answers

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

like image 200
Luzifer42 Avatar answered Sep 30 '22 16:09

Luzifer42


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

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

  • NSIS
  • Janel (dead link)
  • JSmooth
  • Launch4J
  • WinRun4J

(full disclosure: i work on winrun4j)

like image 24
Peter Smith Avatar answered Sep 30 '22 17:09

Peter Smith


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

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

like image 25
Brian Agnew Avatar answered Sep 30 '22 18:09

Brian Agnew