I wonder whether Ubuntu itself provides a system-wide way to find the current JAVA_HOME or whether there is right place for setting JAVA_HOME.
Mac OS X does well in this, for /usr/libexec/java_home command returns the current JAVA_HOME. But to Ubuntu, the materials I found always told me to set the $JAVA_PATH pointing to a static path like ```, which is stored in~/.bash_profile```.
I think, however, this approach has several drawbacks:
- Once Java updates, the mini version number will change, which makes the static path no longer available.
- After changing the JRE used in my system with
update-alternatives, I have to modify $JAVA_HOME in .bash_profile. That extra work is annoying. - Some $JAVA_HOME-required programs, is not aware of
.bash_profileat all. I have to set $JAVA_HOME in their start-up script, therefore a standard-and-easy way to get $JAVA_HOME seems critical to me.
Well, any advice is welcomed. Thanks.
