So I start up a java application in Linux, and get something like this from `pstree`:
Which is all fine until I start up a bunch of apps...
Now I want to know if a certain app is running, or maybe kill a misbehaving one...not so clear which is which. Yeah, I could use `ps aux | grep ...` and I might be able to narrow down a process which belongs to that app and go from there. However even that is a mess with a ton of lines like:
javauser 25635 0.1 2.5 1802196 52688 pts/2 Sl 11:16 0:03 java -server -Xms16m -Xmx16m -Djava.security.policy=/blah/ -Djava.endorsed.dirs=/blah -Dnet.jxta.tls.principal=blah -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -cp [insert MASSIVE classpath here] /blah/blah.jar com.class.name.Here Param Param Param
I know in C it's an easy call to setproctitle(...); to set the process name that is displayed. In fact some apps, like Sendmail, use this to provide a quick status display & activity for each child process -- very handy. I realize that not all OSes have such functionality available, and those that do have different ways of accomplishing it, so this could be more difficult to do in a cross-platform way.
What would be nice is a simple API call to the JVM that would set it if the underlying OS has support, but I cannot find anything of the sort. So the question is, how can I set the process title for my java app (at least on Linux, if not some other OSes)?