VectorLinux

Please login or register.

Login with username, password and session length
Advanced search  

News:

Visit our home page for VL info. For support and documentation, visit the Vector Linux Knowledge Center or search the Knowledge Center and this Forum using the search box above.

Author Topic: [SOLVED] program not found in path  (Read 3292 times)

Verlager

  • Member
  • *
  • Posts: 34
[SOLVED] program not found in path
« 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?
« Last Edit: June 22, 2007, 03:53:59 pm by Verlager »
Logged
Fear believes; courage doubts. Fear falls upon the earth and prays; courage stands erect and thinks. Fear retreats; courage advances. Fear is barbarism; courage is civilization. Fear believes in witchcraft, in devils and in ghosts. Fear is religion, courage is science. —Robert Ingersoll

Triarius Fidelis

  • Vecteloper
  • Vectorian
  • ****
  • Posts: 2399
  • Domine, exaudi vocem meam
    • my website
Re: program not found in path
« Reply #1 on: June 22, 2007, 02:47:45 pm »

Type 'which java'. What comes up?
Logged
"Leatherface, you BITCH! Ho Chi Minh, hah hah hah!"

Formerly known as "Epic Fail Guy" and "Döden" in recent months

Verlager

  • Member
  • *
  • Posts: 34
Re: program not found in path
« Reply #2 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
« Last Edit: June 22, 2007, 02:59:47 pm by Verlager »
Logged
Fear believes; courage doubts. Fear falls upon the earth and prays; courage stands erect and thinks. Fear retreats; courage advances. Fear is barbarism; courage is civilization. Fear believes in witchcraft, in devils and in ghosts. Fear is religion, courage is science. —Robert Ingersoll

Triarius Fidelis

  • Vecteloper
  • Vectorian
  • ****
  • Posts: 2399
  • Domine, exaudi vocem meam
    • my website
Re: program not found in path
« Reply #3 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.
Logged
"Leatherface, you BITCH! Ho Chi Minh, hah hah hah!"

Formerly known as "Epic Fail Guy" and "Döden" in recent months

Verlager

  • Member
  • *
  • Posts: 34
Re: program not found in path
« Reply #4 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*
Logged
Fear believes; courage doubts. Fear falls upon the earth and prays; courage stands erect and thinks. Fear retreats; courage advances. Fear is barbarism; courage is civilization. Fear believes in witchcraft, in devils and in ghosts. Fear is religion, courage is science. —Robert Ingersoll

Triarius Fidelis

  • Vecteloper
  • Vectorian
  • ****
  • Posts: 2399
  • Domine, exaudi vocem meam
    • my website
Re: program not found in path
« Reply #5 on: June 22, 2007, 03:17:53 pm »

Hmm...

Is $JAVA_HOME set?
Logged
"Leatherface, you BITCH! Ho Chi Minh, hah hah hah!"

Formerly known as "Epic Fail Guy" and "Döden" in recent months

Verlager

  • Member
  • *
  • Posts: 34
Re: program not found in path
« Reply #6 on: June 22, 2007, 03:31:38 pm »

root:# $JAVA_HOME
bash: /usr/lib/java: No such file or directory
Logged
Fear believes; courage doubts. Fear falls upon the earth and prays; courage stands erect and thinks. Fear retreats; courage advances. Fear is barbarism; courage is civilization. Fear believes in witchcraft, in devils and in ghosts. Fear is religion, courage is science. —Robert Ingersoll

Triarius Fidelis

  • Vecteloper
  • Vectorian
  • ****
  • Posts: 2399
  • Domine, exaudi vocem meam
    • my website
Re: program not found in path
« Reply #7 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.
Logged
"Leatherface, you BITCH! Ho Chi Minh, hah hah hah!"

Formerly known as "Epic Fail Guy" and "Döden" in recent months

Verlager

  • Member
  • *
  • Posts: 34
Re: program not found in path
« Reply #8 on: June 22, 2007, 03:53:37 pm »

Excellent! It worked perfectly. Thank you so much!
Logged
Fear believes; courage doubts. Fear falls upon the earth and prays; courage stands erect and thinks. Fear retreats; courage advances. Fear is barbarism; courage is civilization. Fear believes in witchcraft, in devils and in ghosts. Fear is religion, courage is science. —Robert Ingersoll

Triarius Fidelis

  • Vecteloper
  • Vectorian
  • ****
  • Posts: 2399
  • Domine, exaudi vocem meam
    • my website
Re: [SOLVED] program not found in path
« Reply #9 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?
Logged
"Leatherface, you BITCH! Ho Chi Minh, hah hah hah!"

Formerly known as "Epic Fail Guy" and "Döden" in recent months

Verlager

  • Member
  • *
  • Posts: 34
Re: [SOLVED] program not found in path
« Reply #10 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?


Logged
Fear believes; courage doubts. Fear falls upon the earth and prays; courage stands erect and thinks. Fear retreats; courage advances. Fear is barbarism; courage is civilization. Fear believes in witchcraft, in devils and in ghosts. Fear is religion, courage is science. —Robert Ingersoll

Triarius Fidelis

  • Vecteloper
  • Vectorian
  • ****
  • Posts: 2399
  • Domine, exaudi vocem meam
    • my website
Re: [SOLVED] program not found in path
« Reply #11 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.
Logged
"Leatherface, you BITCH! Ho Chi Minh, hah hah hah!"

Formerly known as "Epic Fail Guy" and "Döden" in recent months

Verlager

  • Member
  • *
  • Posts: 34
Re: [SOLVED] program not found in path
« Reply #12 on: June 22, 2007, 05:51:19 pm »

Done!
Logged
Fear believes; courage doubts. Fear falls upon the earth and prays; courage stands erect and thinks. Fear retreats; courage advances. Fear is barbarism; courage is civilization. Fear believes in witchcraft, in devils and in ghosts. Fear is religion, courage is science. —Robert Ingersoll