Getting JAVA_HOME at runtime

Greg Lewis glewis at eyesbeyond.com
Mon Apr 17 17:41:19 UTC 2006


On Mon, Apr 17, 2006 at 12:24:57PM +0200, Jean-Baptiste Quenot wrote:
> * Herve Quiroz:
> 
> > ATM you can't. So far, each time I needed such feature I found a
> > workaround or ended up enforcing a JDK in the shell script.
> 
> Actually I found a solution by analyzing what javavm is doing:
> 
>   make -f /usr/ports/Mk/bsd.port.mk -V JAVA_HOME USE_JAVA=yes
> 
> And this will allow the sysadmin to set a version requirement, eg:
> 
>   resin2_java_version=1.5+
> 
> Will be translated into:
> 
>   JAVA_HOME=$(make -f /usr/ports/Mk/bsd.port.mk -V JAVA_HOME USE_JAVA=yes JAVA_VERSION="${resin2_java_version}")
> 
> However it slows down a little bit the rc script.

Yes.  It also potentially fails if the machine has installed the resin2
package but hasn't got the ports tree installed.  javavmwrapper has a
manual fallback in that case, but it would be terribly ugly to add that
to your shell script.

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.

-- 
Greg Lewis                          Email   : glewis at eyesbeyond.com
Eyes Beyond                         Web     : http://www.eyesbeyond.com
Information Technology              FreeBSD : glewis at FreeBSD.org


More information about the freebsd-java mailing list