On Ubuntu it is possible to have multiple JVMs at the same time. The default one is selected with update-alternatives. But this does not set the JAVA_HOME environment variable, due to a debian policy.
I am writing a launcher script (bash), which starts a java application. This java application needs the JAVA_HOME environment variable. So how to get the path of the JVM which is currently selected by update-alternatives?
Thank You!
– Witek May 22 '10 at 10:35echo $(readlink -f /usr/bin/java | sed "s:bin/java::"), the output was/usr/lib/jvm/java-7-oracle/jre/and not/usr/lib/jvm/java-7-oracle/– Sumit Ramteke Jan 31 '14 at 05:20sedworks here: It replacesbin/javawith an empty string. (Here:is used forsedseparator instead of the usual/) – Mohammad Banisaeid Aug 01 '21 at 13:58