VectorLinux

Vectorbie Station => Vectorbie Questions => Topic started by: Verlager on June 22, 2007, 02:20:44 pm

Title: [SOLVED] program not found in path
Post by: Verlager on June 22, 2007, 02:20:44 pm
ooops!

This works:
root:# /usr/lib/jre1.6.0_01/bin/java -version
java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)

root:# $PATH
bash: /usr/local/bin:/usr/bin:/usr/sbin:/bin:/opt/bin:/usr/X11/bin:/usr/local/games:/usr/lib/java/bin:/usr/lib/java/jre/bin:/usr/lib/qt/bin:/opt/seamonkey/bin:/usr/local/sbin:/usr/sbin:/sbin: No such file or directory

Seeing as /usr/local/bin is pathed, it makes sense to create a link from there to java:

root:# ls -l /usr/local/bin/java
lrwxrwxrwx 1 root root 29 2007-06-22 16:59 /usr/local/bin/java -> /usr/lib/jre1.6.0_01/bin/java*

But, when I type 'java -version', I get an error:

root:# java -version
bash: /usr/lib/java/bin/java: No such file or directory

Why is this? Maybe I inadvertently deleted a file? How can be sure that I am using the 1.6 java rather than the 1.5 java? Why isn't the link I created picked up on the CLI when it's clearly in the PATH?
Title: Re: program not found in path
Post by: Triarius Fidelis on June 22, 2007, 02:47:45 pm
Type 'which java'. What comes up?
Title: Re: program not found in path
Post by: Verlager on June 22, 2007, 02:57:41 pm
root:# which java
/usr/local/bin/java

 but:

root:#  which -a java
/usr/local/bin/java
/usr/bin/java
Title: Re: program not found in path
Post by: Triarius Fidelis on June 22, 2007, 03:02:52 pm
Ah, that might explain it. What kind of file is /usr/bin/java? Also a link, or something else?

In any case, if the JRE binary directory already sits in your $PATH, I don't see why you need to add any links to it.
Title: Re: program not found in path
Post by: Verlager on June 22, 2007, 03:15:42 pm
root:# ls -l /usr/bin/java
lrwxrwxrwx 1 root root 29 2007-06-22 16:37 /usr/bin/java -> /usr/lib/jre1.6.0_01/bin/java*
Title: Re: program not found in path
Post by: Triarius Fidelis on June 22, 2007, 03:17:53 pm
Hmm...

Is $JAVA_HOME set?
Title: Re: program not found in path
Post by: Verlager on June 22, 2007, 03:31:38 pm
root:# $JAVA_HOME
bash: /usr/lib/java: No such file or directory
Title: Re: program not found in path
Post by: Triarius Fidelis on June 22, 2007, 03:43:02 pm
Bingo...how did you install the JRE? Your setup looks to be buggered.

Anyway, try typing

export JAVA_HOME=/usr/lib/jre1.6.0_01

and see if you can run Java. It's not a permanent solution, however, and we shall have to find out what's wrong with your kit.
Title: Re: program not found in path
Post by: Verlager on June 22, 2007, 03:53:37 pm
Excellent! It worked perfectly. Thank you so much!
Title: Re: [SOLVED] program not found in path
Post by: Triarius Fidelis on June 22, 2007, 03:55:48 pm
You still probably want to fix that Java installation. It looks like you installed a recent JRE version yourself. Did you add an appropriate /etc/profile.d/jre.sh?
Title: Re: [SOLVED] program not found in path
Post by: Verlager on June 22, 2007, 04:25:14 pm
To install java I did:

chmod a+x JRE-6u1-linux-i586.bin
mv jre1.6.0_01 /usr/lib


This seemed OK, because there is another similar directory, /usr/lib/jre1.5.0_09 at the same level. Now all I have to do (or so I thought) was to change the link to /usr/lib/jre15.0_09/bin/java and point it to the new /usr/lib/jre1.6.0_01/bin/java file. I've done it several times successfully in the past with ZW, the sister distro.

Yikes... no, I haven't edited the /etc/profile.d/jre.sh.

(original)

#!/bin/sh
export JAVA_HOME=/usr/lib/java
export MANPATH="$MANPATH:/usr/lib/java/man"
export PATH="$PATH:/usr/lib/java/bin:/usr/lib/java/jre/bin"

(proposed changes)

#!/bin/sh
export JAVA_HOME=/usr/lib/jre1.6.0_01
export MANPATH="$MANPATH:/usr/lib/java/man"
export PATH="$PATH:/usr/lib/java/bin:/usr/lib/java/jre/bin"

Should lines 3-4 also be edited?


Title: Re: [SOLVED] program not found in path
Post by: Triarius Fidelis on June 22, 2007, 04:38:32 pm
You have two JREs installed, the distro default and your own. That's OK I guess, as long as you're careful about how you set it up. The profile script should read:

Code: [Select]
#!/bin/sh
export JAVA_HOME=/usr/lib/jre1.6.0_01
export MANPATH="$MANPATH:$JAVA_HOME/man"
export PATH="$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin"

Try that.
Title: Re: [SOLVED] program not found in path
Post by: Verlager on June 22, 2007, 05:51:19 pm
Done!