Server Fault is a question and answer site for system and network administrators. 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

Want to have something that lists java VMs running on the system and which programs these are hosting. In particular which tomcat is using which java version. IS there any command line tool that I can use on debian like systems?

For tomcat specifically I've found :

ps uax | grep tomcat

which gives the full command line that includes path to the java vm used, however is there a more java oriented way of getting a comprehensive listing?

share|improve this question

If properly installed using the update-java-alternatives, you can find them by issuing:

# update-java-alternatives -l
java-1.6.0-openjdk-amd64 1061 /usr/lib/jvm/java-1.6.0-openjdk-amd64
java-1.7.0-openjdk-amd64 1071 /usr/lib/jvm/java-1.7.0-openjdk-amd64
java-gcj-4.6 /usr/lib/jvm/java-gcj-4.6
java-gcj-4.7 /usr/lib/jvm/java-gcj-4.7
jdk1.7.0_03 7003 /usr/lib/jvm/jdk1.7.0_03

Otherwise, if only installed with the plain update-alternatives system, use:

# update-alternatives --display java

If you just drop JREs/JDKs anywhere, you will have to parse the output of something more targeted than

# ps -def | grep java

Something similar with regards to Tomcat. If you installed Tomcat using the repositories, the file /etc/default/tomcat{6,7} contains a JAVA_HOME variable that points to the JRE/JDK used by this instance.

share|improve this answer
java -version

Also, run a file on /etc/alternatives/java. That will show the location of the binary.

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.