Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 5 down vote accepted

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
share|improve this answer

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.

share|improve this answer

Restarting a program when it is down could be done very differently. For example:

jstart () {
    java -cp /foo/bar baz.Main 

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.

share|improve this answer
  1. Use the options to ps that let you see the parameters (i.e. main class name)

  2. Create a softlink to java.exe, with the name you desire, and use that to run the program. (untested)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.