Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Apr 2006 00:23:43 +0200
From:      Herve Quiroz <herve.quiroz@esil.univ-mrs.fr>
To:        java@freebsd.org
Subject:   Re: Getting JAVA_HOME at runtime
Message-ID:  <20060411222343.GA55418@arabica.esil.univ-mrs.fr>
In-Reply-To: <20060411180145.GP53974@vision.anyware>
References:  <20060411180145.GP53974@vision.anyware>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Apr 11, 2006 at 08:01:46PM +0200, Jean-Baptiste Quenot wrote:
> The Java ports infrastructure provides JAVA_HOME on build-time to
> port's Makefile.  But is it possible to get this variable from
> /usr/local/bin/java at runtime?
> 
> How to change the Java version for a port at runtime in the rc
> script?  It is possible to set the preferred JDK in
> /usr/local/etc/javavms but then JAVA_HOME still needs to be
> set manually.
> 
> I would like to avoid hard-coding the JAVA_HOME at build time in
> the rc scripts.
> 
> Any idea?

In /usr/local/bin/javavm, line 447:

  export JAVA_HOME
  tryJavaCommand "${JAVA_HOME}/bin/${IAM}" "${@}"

So indeed, JAVA_HOME is set accordingly to the JVM picked up by the
script.

That's how the launcher shell script works for devel/maven2 for example.

Herve



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060411222343.GA55418>