简体   繁体   中英

JDK not recognized after installation in Ubuntu 12.10

I did these steps without error:

  1. JDK path :

     Downloads/jdk-6u37-linux-x64.bin 
  2. Commands in Terminal:

     mkdir Programs cd Programs bash ../Downloads/jdk-6u37-linux-x64.bin ln -s jdk-6u37-linux-x64 jdk 
  3. Set JAVA_HOME and Path:

    I added the following lines to the end of the .bashrc file:

     export JAVA_HOME=$Home/Programs/jdk export PATH=:$JAVA_HOME/bin:$PATH 

This is the result of executing the command echo $JAVA_HOME :

/Programs/jdk

This is the result of executing the command echo $PATH :

:/Programs/jdk/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games1

And the problem is:
This is the result of executing the command

$ java -version

The program 'java' can be found in the following packages:
 * default-jre
 * gcj-4.6-jre-headless
 * gcj-4.7-jre-headless
 * openjdk-7-jre-headless
 * openjdk-6-jre-headless
Try: sudo apt-get install 

I think the problem is that environment variables are case sensitive in linux, so your

export JAVA_HOME=$Home/Programs/jdk

Should be

export JAVA_HOME=$HOME/Programs/jdk

In your echo $JAVA_HOME output you can see that you don't get your /home/yourname prepended...

Hope that helps.

Cheers,

The scripts located here will help you install sun's jdk on Ubuntu. Really useful stuff.

try this command

sudo update-alternatives --config java

This will list all the Java versions installed and configured.

If you see one or more installs, it will give you a list each element starting with a number. Just choose the number that corresponds to the version you want to use by default.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM