Integrating beta version of Java with Gentoo

If you’re using Gentoo I think we can dispense with obvious stuff like using sudo to extract a tar ball to /opt ….

While you could make temporary modifications to your PATH for a terminal session things are altogether more comfortable if you can use eselect / java-config to quickly and easily switch between jvm’s and compilers.

java-config stores the VM configurations in /usr/share/java-config-2/vm/ pity its not in /etc but ah well…

its very easy to see from this sample configuration how you can modify it for whatever version / path you need

VERSION="Oracle-Sun JDK 8u_60"
JAVA_HOME="/opt/jdk1.8.0_60"
JDK_HOME="/opt/jdk1.8.0_60"
JAVAC="${JAVA_HOME}/bin/javac"
PATH="${JAVA_HOME}/bin:${JAVA_HOME}/jre/bin"
ROOTPATH="${JAVA_HOME}/bin:${JAVA_HOME}/jre/bin"
LDPATH="${JAVA_HOME}/jre/lib/amd64/:${JAVA_HOME}/jre/lib/amd64/native_threads/:${JAVA_HOME}/jre/lib/amd64/xawt/:${JAVA_HOME}/jre/lib/amd64/server/"
MANPATH="/opt/jdk1.8.0_60/man"
PROVIDES_TYPE="JDK JRE"
PROVIDES_VERSION="1.8"
# Taken from sun.boot.class.path property
BOOTCLASSPATH="${JAVA_HOME}/jre/lib/resources.jar:${JAVA_HOME}/jre/lib/rt.jar:${JAVA_HOME}/jre/lib/jsse.jar:${JAVA_HOME}/jre/lib/jce.jar:${JAVA_HOME}/jre/lib/charsets.jar"
GENERATION="2"
ENV_VARS="JAVA_HOME JDK_HOME JAVAC PATH ROOTPATH LDPATH MANPATH"
VMHANDLE="oracle-jdk8u_60"
BUILD_ONLY="FALSE"

NB I have marked in red any path or version specific entries that you’ll need to change.

Once you have that in place just use eselect / java-config  as you would normally.

Leave a Reply

Your email address will not be published. Required fields are marked *