From owner-freebsd-java@FreeBSD.ORG Tue Apr 11 22:23:46 2006 Return-Path: X-Original-To: java@freebsd.org Delivered-To: freebsd-java@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 95C3516A402 for ; Tue, 11 Apr 2006 22:23:46 +0000 (UTC) (envelope-from herve.quiroz@esil.univ-mrs.fr) Received: from arabica.esil.univ-mrs.fr (arabica.esil.univ-mrs.fr [139.124.41.108]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0485D43D45 for ; Tue, 11 Apr 2006 22:23:45 +0000 (GMT) (envelope-from herve.quiroz@esil.univ-mrs.fr) Received: from arabica.esil.univ-mrs.fr (localhost [127.0.0.1]) by arabica.esil.univ-mrs.fr (8.13.4/8.13.4) with ESMTP id k3BMNiem055459 for ; Wed, 12 Apr 2006 00:23:44 +0200 (CEST) (envelope-from herve.quiroz@esil.univ-mrs.fr) Received: (from rv@localhost) by arabica.esil.univ-mrs.fr (8.13.4/8.13.4/Submit) id k3BMNhbt055458 for java@freebsd.org; Wed, 12 Apr 2006 00:23:43 +0200 (CEST) (envelope-from herve.quiroz@esil.univ-mrs.fr) X-Authentication-Warning: arabica.esil.univ-mrs.fr: rv set sender to herve.quiroz@esil.univ-mrs.fr using -f Date: Wed, 12 Apr 2006 00:23:43 +0200 From: Herve Quiroz To: java@freebsd.org Message-ID: <20060411222343.GA55418@arabica.esil.univ-mrs.fr> Mail-Followup-To: java@freebsd.org References: <20060411180145.GP53974@vision.anyware> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060411180145.GP53974@vision.anyware> User-Agent: Mutt/1.4.2.1i Cc: Subject: Re: Getting JAVA_HOME at runtime X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Apr 2006 22:23:46 -0000 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