From owner-freebsd-java@FreeBSD.ORG Tue Apr 5 13:32:30 2005 Return-Path: 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 AF30116A4D0 for ; Tue, 5 Apr 2005 13:32:30 +0000 (GMT) Received: from arabica.esil.univ-mrs.fr (arabica.esil.univ-mrs.fr [139.124.41.108]) by mx1.FreeBSD.org (Postfix) with ESMTP id 160CE43D3F for ; Tue, 5 Apr 2005 13:32:29 +0000 (GMT) (envelope-from herve.quiroz@esil.univ-mrs.fr) Received: from arabica.esil.univ-mrs.fr (localhost [127.0.0.1]) j35DWCNl063569; Tue, 5 Apr 2005 15:32:12 +0200 (CEST) (envelope-from herve.quiroz@esil.univ-mrs.fr) Received: (from rv@localhost) by arabica.esil.univ-mrs.fr (8.13.3/8.13.3/Submit) id j35DW5cq063568; Tue, 5 Apr 2005 15:32:05 +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: Tue, 5 Apr 2005 15:32:05 +0200 From: Herve Quiroz To: Sam Lawrance Message-ID: <20050405133205.GA63174@arabica.esil.univ-mrs.fr> Mail-Followup-To: Sam Lawrance , java@FreeBSD.org References: <1112706453.750.22.camel@dirk.no.domain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1112706453.750.22.camel@dirk.no.domain> User-Agent: Mutt/1.4.2.1i cc: java@FreeBSD.org Subject: Re: JDK specific classpaths X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2005 13:32:30 -0000 Hi Sam, On Tue, Apr 05, 2005 at 11:07:32PM +1000, Sam Lawrance wrote: > Since you're around, and handling java PRs... hope you don't mind :) > > I'm looking at the NetRexx port right now. In order to work it needs > sun.tools.javac.* in the classpath. That stuff is located > in /usr/local/SOME_JDK/lib/tools.jar > > Any suggestions as to how java should be invoked to provide the > "correct" tools.jar? > > Simplified, but something akin to: > java -cp $JDK_HOME/lib/tools.jar > > Any suggestions? I would indeed use the same approach as you explain here. To detail further, I would use a launcher shell script 'files/netrexx.sh.in': #!/bin/sh "%%JAVA%%" -cp "%%JAVA_HOME%%/lib/tools.jar" ... And in the Makefile: SUB_FILES= netrexx.sh SUB_LIST= JAVA="${JAVA}" JAVA_HOME="${JAVA_HOME}" do-install: ${INSTALL_SCRIPT} ${WRKDIR}/netrexx.sh ${PREFIX}/bin/netrexx The downside of this approach is that it is not flexible: the end user cannot switch JDK at runtime. So here is another approach (still using the same Makefile): #!/bin/sh JAVA_HOME="${JAVA_HOME:-"%%JAVA_HOME%%"}" "${JAVA_HOME}/bin/java" -cp "${JAVA_HOME}/lib/tools.jar" ... A last approach would be to implement a 'java-home' tool, part of java/javavmwrapper, that would use the same logic as javavm but to produce a suitable JAVA_HOME value. Then: #!/bin/sh export JAVA_VERSION="%%JAVA_VERSION%%" JAVA_HOME="${JAVA_HOME:-"`%%LOCALBASE%%/bin/java-home`"}" "%%LOCALBASE%%/bin/java" -cp "${JAVA_HOME}/lib/tools.jar" ... NOTE: %%JAVA_VERSION%% is already added automatically to SUB_LIST by bsd.java.mk, as well as %%LOCALBASE%%. That said, and until some volunteer starts working on improving javavmwrapper, I would go with method #2 (overridable JAVA_HOME). Hope that helps. Anyway, I'm looking forward to your next PR :) Herve