Re: Using JNI to determine whether an object implements an interface
Steve Sobol wrote:
I prefer to use Oracle's JDK/JRE...
but *every time* I set up a new Linux box, I end up uninstalling
the JDK or JRE that ships with it, and installing the latest VM
from Oracle.
Forcing users to use a specific VM from a specific vendor is
just a Bad Idea(tm). It's a Worse Idea(tm) when that VM
isn't installed by default. :)
I've used both the [/etc/]alternatives mechanism and manual symlinks to
facilitate use of multiple JDKs/JREs. There's really no need to delete the
distro default, or any particular Java version. You just set JAVA_HOME to and
PATH to include, say, /opt/java/java and Bob's your uncle.
Then you symlink /opt/java/java to your preferred version and he's your aunt, too.
For more fluid shifts, use scripts to reset JAVA_HOME and PATH coordinatedly
to any specific Java version.
Example:
$ echo $JAVA_HOME $'\n'$PATH
/opt/java/java
/home/hero/bin:/opt/java/android/android/tools:/opt/java/java/bin:/opt/java/ant/ant/bin:/opt/tomcat/tomcat/bin:/opt/netbeans/netbeans/bin:/opt/glassfish/glassfish/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/postgresql/8.4/bin
$ JAVA_HOME=/opt/java/jdk1.7.0
$
PATH=~/bin:$ANDROID_HOME/tools:$JAVA_HOME/bin:$ANT_HOME/bin:$CATALINA_HOME/bin:$NETBEANS_HOME/bin:$GLASSFISH_HOME/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:$PG_HOME/bin
The redefinition pegs Java to version 7 specifically, whilst leaving the other
elements at their symlink defaults.
--
Lew