Date: Sat, 15 Apr 2006 02:41:25 +0200 From: Herve Quiroz <herve.quiroz@esil.univ-mrs.fr> To: java@freebsd.org Subject: Re: Getting JAVA_HOME at runtime Message-ID: <20060415004125.GA57315@arabica.esil.univ-mrs.fr> In-Reply-To: <20060412180028.GB29790@vision.anyware> References: <20060411180145.GP53974@vision.anyware> <20060411222343.GA55418@arabica.esil.univ-mrs.fr> <20060412180028.GB29790@vision.anyware>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Apr 12, 2006 at 08:00:28PM +0200, Jean-Baptiste Quenot wrote: > > 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. > > OK, but imagine that the target application has a shell script > that needs JAVA_HOME. There are plenty of programs that are based > on JAVA_HOME instead of the java binary. > > How to get the preferred JAVA_HOME? 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. Depending on the script you have in mind, such feature could indeed be interesting to implement. The main problem I see here is that javavm cannot tell which JVM is the good one until it manages to run one. So the only way to be sure of our JAVA_HOME would be to run a Java class that uses System.getEnv() to display JAVA_HOME to the standard output. This would just double the startup time of the application. Anyway, if this JAVA_HOME is important to determine, and when dealing with a "server" application which is run once in a while (e.g. at boot), I can imagine it could be worth it. Herve
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060415004125.GA57315>