I am trying to install jdk-6 in ubuntu 12.04. I put the folder in /opt
and set the environment path:
vim /etc/profile
vim /etc/bash.bashrc
add this to both of the files:
#set java environment
export JAVA_HOME=/opt/jdk1.6.0_37
export JRE_HOME=/opt/jdk1.6.0_37/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
I change the user status to root user
so I have the authority to edit the file. After that, I use java -version
to check the result, it works fine in root user
status:
root@brendon-Lenovo:/home/brendon# java -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
But when I change back to normal user, I can't find the jdk I've installed:
brendon@brendon-Lenovo:~$ java -version
程序 'java' 已包含在下列软件包中:
* default-jre
* gcj-4.6-jre-headless
* openjdk-6-jre-headless
* gcj-4.5-jre-headless
* openjdk-7-jre-headless
I check the profile and bash.bashrc, both of them are modified, so I really have no idea why can't I use jdk-6 in my normal status.
Does anyone know why?
I have tried
sudo chmod -R 755 /opt/[java folder name]
sudo chown -R [username] /opt/[java folder name]
Then I check the java -version
, anyway, it doesn't work.
The program 'java' can be found in the following packages:
* default-jre
* gcj-4.6-jre-headless
* openjdk-6-jre-headless
* gcj-4.5-jre-headless
* openjdk-7-jre-headless