[nSLUG] Re: Java Installation Question

Kevin Fleming kfleming at accesswave.ca
Mon Nov 28 11:41:18 AST 2005

Hello Mike and Donald:

	Firstly, thank you both for your replies to my query, and I do
appreciate your taking the time to give me an answer.  I had thought of
locate and the differences between which and whereis, but I had not
known that tcsh had its' own version of which. 

	I guess I should have included a copy of the java.sh script I put into
the /etc/profile.d/ directory, along with a copy labeled java.csh for
other shell environments that may be used.  I use the Bourne Again
SHell, but I guess that's just a matter of taste. Here it is (the shell
file, that is) in /etc/profile.d/java.sh:

export JRE_HOME=/usr/java/jre1.5.0_05
export PATH=$PATH:JRE_HOME/bin

(should I have added a '/' on the end of that last line?) 

	This does seem to add the JRE_HOME variable to the $PATH command, 
as evidenced by the 'echo $PATH' command shown here:

[kevin at kevinwork ~]$ echo $PATH

	But whereis and which both do NOT find the java executable for some
reason, even if the PATH has the variable included in it:

[kevin at kevinwork ~]$ whereis java
[kevin at kevinwork ~]$ which java 
which: no java in

	When I run locate as root or in my normal login, it finds all the usual
suspects in all the usual places, and lists them no problem. (The output
is huge, and lists all files with 'java' included in the names)  But
when I run /usr/java/jre1.5.0_05/bin/java -version as root, here is the

[root at kevinwork kevin]# /usr/java/jre1.5.0_05/bin/java -version
java version "1.5.0_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_05-b05)
Java HotSpot(TM) Client VM (build 1.5.0_05-b05, mixed mode, sharing)

And as my normal login, here is the output:

[kevin at kevinwork ~]$ /usr/java/jre1.5.0_05/java -version
bash: /usr/java/jre1.5.0_05/java: No such file or directory

	I am wondering if I should perhaps edit my .bashrc or .bash_profile
file to include the path to the java directories, and have it available
for the shell to set in my user accounts?

	Where have I made the error, and how do I correct it?  Should I link to
the java executable in /usr/bin and go that way, or can I fix it by
editing the .bash_profile PATH variable setting in that file?  This one
has me stumped, as I am not sure why it is happening, nor do I know what
is causing it to happen.  I had thought that adding the java.sh script
would set the PATH variable to include the directory globally, and I
wouldn't have to fool with any other PATH variables to get it to show up
in a user login.  I guess I was wrong on that, unless there is something
wrong with my shell script.  

	Any ideas, comments, or suggestions will be considered.  Of course I
don't think that 'rm *.*' at the root is really a solution to the
problem. ;-) 

Kevin Fleming

kfleming at accesswave.ca

21 Winterhill Road
RR#1 Site 18 Box 18
Lower East Chezzetcook 
Nova Scotia B0J 1N0
 /( )\
Registered Linux User# 197985


More information about the nSLUG mailing list