-   Linux - Software (
-   -   java path (

Whatif 02-07-2011 01:03 PM

java path
I have installed CentOS 5.5 and included the java development package. When I typed java -version, I got java 1.6.0. The problem is with the javac command, which is not found. I tried the following:

export PATH=$PATH:/usr/java/jdk1.6.0/bin

didn't work!

Any suggestions?


knudfl 02-07-2011 01:14 PM

Setting up a new java in CentOS ..

1) su
/usr/sbin/alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_23/bin/java 2

3) /usr/sbin/alternatives --config java

Whatif 02-07-2011 01:31 PM

I tried these commands and was given three options:

1 /usr/lib/jvm/jre-1.6.0-openjdk/bin/java
2 /usr/lib/jvm/jre-1.4.2-gcj/bin/java
3 /usr/lib/jvm/jdk1.6.0_23/bin/java

I chose option 3 but issuing the java -version resulted in bash : java : command not found.
I then tried option 1 and 2, issuing the java -version displayed java version and additional info but the javac is still not found, bash : javac : command not found

What else could I try?

knudfl 02-08-2011 03:34 PM


3 /usr/lib/jvm/jdk1.6.0_23/bin/java
Are you sure, you have /usr/lib/jvm/jdk1.6.0_23/bin/ ?
Will only be present, when you install the sun-java-jdk

A standard install will provide /usr/java/jdk1.6.0_23/bin/java
( /usr/java/ instead of /usr/lib/jvm/jdk1.6.0_23 ).


Whatif 02-08-2011 04:12 PM

I'm sorry.....I typed that in error. It's /usr/java/jdk1.6.0_23/bin/java

I will try the instructions in the link you provided, thanks.

Whatif 02-09-2011 04:34 PM

Still not working! I tried the following:

/usr/sbin/alternatives --install /usr/bin/javaws javaws /usr/java/jdk1.6.0_23/jre/bin/javaws 2

/usr/sbin/alternatives --install /usr/bin/javac javac /usr/java/jdk1.6.0_23/bin/javac 2

running javac -version gives command not found.

Anything else I could try?

Whatif 02-10-2011 06:15 PM

I tried these commands, here is the output:

rpm -q centos-release

locate bin/javac
locate : can not open '/var/lib/mlocate/mlocate.db' : no such file or directory

rpm -qf /usr/java/jdk1.6.0_23/bin/javac
error : file /usr/java/jdk1.6.0_23/bin/javac : No such file or directory

any suggestions?

knudfl 02-11-2011 01:53 PM

How did you install jdk1.6.0_23 ? Package name, please.

For my systems, I use : jdk-1.6.0_22-fcs.i586.rpm / jdk-1.6.0_22-fcs.x86_64.rpm
In the CentOS identical 'Scientific Linux SL55' it's simply # yum install jdk

About 'locate' : Please run # 'updatedb' to create / update /var/lib/mlocate/mlocate.db


All times are GMT -5. The time now is 12:29 PM.