Getting JAVA_HOME at runtime

Herve Quiroz herve.quiroz at esil.univ-mrs.fr
Wed Apr 19 00:43:39 UTC 2006


On Tue, Apr 18, 2006 at 10:48:58AM +0200, Jean-Baptiste Quenot wrote:
> > Unfortunately  I don't  have  a  good solution  to  that at  the
> > moment.   It almost  seems like  we want  a flag  or environment
> > variable  that tells  javavmwrapper to  dump what  it found  out
> > rather than actually executing anything.
> 
> That would be interesting, but can you confirm that the JDK lookup
> algorithm is  implemented both in  bsd.java.mk and in  javavm?  We
> might want to  unify both, for example bsd.java.mk  should use the
> wrapper.

Actually, I don't think having bsd.java.mk using the wrapper would be
simple. javavmwrapper is installed as a port, and bsd.java.mk is part of
the ports system. That's why we chose to implement things the exact
opposite way.

The JDK choosing algorithm is only implemented in bsd.java.mk. It picks
a suitable JDK (according to version, vendor, etc) amongst the ones in
ports. bsd.java.mk also handles the case when no JDK is suitable and
finds out which one should be installed. javavmwrapper, OTOH, uses the
logic from bsd.java.mk (not reimplementing it) to pick a port that is
*already* installed via the ports. But javavmwrapper also handles JVMs
registered in ${PREFIX}/etc/javavms and will take user-set JAVA_HOME
into consideration.


Back to the original topic (finding out JAVA_HOME), I had already
thought of a quick hack to get javavm displaying JAVA_HOME. I think I
can provide a patch for this feature if needed.

Herve


More information about the freebsd-java mailing list