3
# which java
/usr/bin/which: no java in (/usr/local/jdk/jdk1.5.0_10/bin/java:/usr/local/jdk/jdk1.5.0_10/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin)

I installed java in /usr/local/jdk/jdk1.5.0_10 but cannot run java -version

I get this

$ java -version
-bash: /usr/bin/java: No such file or directory

this is red hat linux

1
  • Questions like this belong on "superuser.com" or some such. Commented Jan 30, 2010 at 5:05

3 Answers 3

3

It's not in your path.

use

export PATH=$PATH:/usr/local/jdk/jdk1.5.0_10/bin

export JAVA_HOME=/usr/local/jdk/jdk1.5.0_10

Look at ~/.bash_profile for where to define this permanatly.

Sign up to request clarification or add additional context in comments.

2 Comments

[root@server1 bin]# export PATH=$PATH:/usr/local/jdk/jdk1.5.0_10/bin [root@server1 bin]# export JAVA_HOME=/usr/local/jdk/jdk1.5.0_10 [root@server1 bin]# java -bash: java: command not found [root@server1 bin]# java -version -bash: java: command not found
@ttommy851 You have problems with your $PATH setting. Within your jdk there is a bin directory. Within that directory is the "java" executible. That is the "java" that you are not finding. Navigate to that directory and type "ls", you should see the java file. Type "./java", you should see some output of some kind. If you type "echo $PATH" you'll see what your path is set to, you probably need to adjust that.
0

Can you do ls /usr/local/jdk/jdk1.5.0_10/bin And why is /usr/local/jdk/jdk1.5.0_10/bin/java in your path?

4 Comments

# ls /usr/java ls: /usr/java: No such file or directory
# ls /usr/local/jdk/jdk1.5.0_10/bin ls: /usr/local/jdk/jdk1.5.0_10/bin: No such file or directory
And why is /usr/local/jdk/jdk1.5.0_10/bin/java in your path? I added it just to see if it works. Shall I remove it?
Java isn't installed where you think it is (/usr/local/jdk...). Try looking in /usr/java/jdk1.5.0_10 instead.
0

Must be in local path of java before running to see what version is installed. Use find / -name java (this will list anything with java on the server copy the path ). path should end with..../jre/bin/java copy full path.

Open Java location of the path you copied above, remove java at the end you path then enter, Enter command below:
./Java -Version

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.