Which java binary to use?

Bahman M. b.movaqar at adempiere.org
Tue Oct 9 02:01:30 PDT 2007


On 2007-10-08 Stephen Allen wrote:
> I installed the Diablo java packages
> (http://www.freebsdfoundation.org/downloads/java.shtml), but "which
> java" shows "/usr/local/bin/java" which is a link to javavm in the
> same directory.
> 
> I wondered about changing the link to point to one of these:
> 
>       /usr/local/diablo-jre1.5.0/bin/java
>       /usr/local/diablo-jdk1.5.0/bin/java
>       /usr/local/diablo-jdk1.5.0/jre/bin/java
> 
> Should I change the link, and which one of these should it point to...
> the JRE?

I'd suggest installing java/javavmwrapper from ports.

Quoting from javavmwrapper/pkg-descr: "The Java VM wrapper provides a
convenient system for switching between different Java VMs.  It also
provides symbolic links in ${PREFIX}/bin to allow the use of the Java
executables without having to add the specific Java VM executable
directories to the PATH environment variable."


After installing, instead of changing symbolic links, all you need to
do is to change the JAVA_HOME variable in a configuration file.  Below
is a snippet of my configuration using Diablo 1.5 and JDK 1.6.

[snip]
# JDK 1.6  (Currently commented, i.e. disabled)
#JAVA_HOME=/usr/local/jdk1.6.0
#JAVA_OS=native
#JAVA_VENDOR=freebsd
#JAVA_VERSION=1.6
#JAVAVM_OPTS=-XX:+UseThreadPriorities

# JDK 1.5 (The active JVM)
JAVA_HOME=/usr/local/dialblo-jdk1.5.0
JAVA_OS=native
JAVA_VENDOR=freebsd
JAVA_VERSION=1.5
JAVAVM_OPTS=-XX:+UseThreadPriorities
[/snip]

HTH,

Bahman



More information about the freebsd-questions mailing list