How to run java process to be seen not as 'java...' in processes list?
Solution 1
Try Java Virtual Machine Process Status Tool(
jps)
:
[Tue Aug 30@17:02:14][prince@localhost ~]$ jps -l
30207 sun.tools.jps.Jps
29947 org.netbeans.Main
Solution 2
Restarting a program when it is down could be done very differently. For example:
#!/bin/bash
jstart () {
java -cp /foo/bar baz.Main
jstart
}
Start your script, and if the program terminates, it gets restarted immediately.
You have to hit Ctrl + C to terminate your script, or kill the script by name.
Solution 3
Use the options to
ps
that let you see the parameters (i.e. main class name)Create a softlink to
java.exe
, with the name you desire, and use that to run the program. (untested)
Solution 4
Here is a description of how to change the program name.
It is done by changing the first program argument argv[0]
, which contains the program name. This makes it necessary to write a small wrapper around the Java binary.
Related videos on Youtube
Blazej Kroll
Updated on September 18, 2022Comments
-
Blazej Kroll over 1 year
Is it possible to run a Java process in Linux in a way that it could be seen in
ps
as some sort of alias? It would be easier to restart it when it is down.