[25816] in Athena Bugs

home help back first fref pref prev next nref lref last post

linux 9.3.8: /usr/java/j2re1.4.2_04/bin/java

daemon@ATHENA.MIT.EDU (Jacob Morzinski)
Fri Jul 16 18:03:52 2004

Message-Id: <200407162203.i6GM3mVC002178@alice-whacker.mit.edu>
To: bugs@mit.edu
Date: Fri, 16 Jul 2004 18:03:48 -0400
From: "Jacob Morzinski" <jmorzins@mit.edu>
Errors-To: bugs-bounces@mit.edu

System name:		alice-whacker.mit.edu
Type and version:	i686 9.3.8 (with mkserv)
Display type:		ATI Technologies Inc 3D Rage Pro AGP 1X/2X (rev 5c)

Shell:			/bin/sh
Window manager:		unknown

What were you trying to do?
	I was hoping to run the local disk "java" interpreter
	on Linux, like I can on Solaris.

What's wrong:
	A j2re is installed, but java isn't in the PATH.

What should have happened:
	It would have been nice for "java" to run the JRE that is
	installed in /usr/java/j2re1.4.2_04/bin/java

Please describe any relevant documentation references:
	The RPM that installs the j2re doesn't create a link
	in /usr/bin .  I found mailing list archives that suggest
	that the reason that people don't create a /usr/bin/java is
	that they're afraid of the sitution where multiple JRE's
	might be installed.  (I.e., "Which jre should the
	/usr/bin/java link point to?")

	This doesn't seem to be a big problem for Athena ... people
	who want to use multiple JRE's will probably pull them out
	of AFS, where we already have a system for managing
	versions.  The presense of a local java interpreter on
	Solaris doesn't seem to have interfered with this system.

	If Athena decides that it would be a good idea to let the
	Linux machines resemble the Solaris machines in having a
	"java" binary, one way to add "java" to the path is to use
	Linux's /etc/profile.d/*.{csh,sh} system to configure java.
	For example, the following two java.sh and java.csh files
	would extend a user's PATH so that "java" is available.

cat > /etc/profile.d/java.sh << 'EOF'
JAVA_HOME=/usr/java/j2re1.4.2_04
PATH="$PATH":"$JAVA_HOME"/bin
export JAVA_HOME PATH
EOF

cat > /etc/profile.d/java.csh << 'EOF'
setenv JAVA_HOME /usr/java/j2re1.4.2_04
set path = ( $path:q $JAVA_HOME:q/bin )
EOF

	If a future RPM puts java in the PATH, backing out this
	change will be as simple as removing these two files.
	
	If RedHat upgrades the installed j2re, the script could be
	made more intelligent about how it locates JAVA_HOME.  See
	the "for i in $jre_list" loop in the "GetLatestJavaWSPath()"
	shell function in "rpm -q --scripts j2re-1.4.2_04-fcs".

	Because these java.{csh,sh} files extend the PATH, repeated
	execution of the files will repeatedly extend the path.
	If this is a problem, the files could use /bin/athena/attach
	instead of extending the PATH directly:
	    eval "`/bin/athena/attach -Padd $JAVA_HOME/bin`"
	(Bash needs "attach -Padd -b")

	Credit for /etc/profile.d/java.{csh,sh}:
  http://www.redhat.com/archives/fedora-list/2003-December/msg01672.html


-Jacob

home help back first fref pref prev next nref lref last post