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?


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.

java -version

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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