I try to install jdk1.7.0_79 in ubuntu 14.04 First I download jdk1.7.0_79 Zip File.Then extact file and put it into download folder.
Then I create a directory like this
sudo mkdir /usr/lib/jvmThen move jdk1.7.0_11 into the /usr/lib/jvm
sudo mv /Downloads/jdk1.7.0_79 /usr/lib/jvmThen install file into followng step
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0_79/bin/javac"This similar to both javac and javaws installation. Then I try
computerlabug@computerlab:/usr/bin$ java -version
bash: /usr/bin/java: No such file or directory And Configure as follows
computerlabug@computerlab:/usr/bin$ sudo update-alternatives --config java There are 2 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/lib/jvm/jdk1.7.0_79/bin/java 2 auto mode 1 /usr/lib/jvm/jdk1.7.0_79/bin//java 1 manual mode 2 /usr/lib/jvm/jdk1.7.0_79/bin/java 2 manual mode
Press enter to keep the current choice[*], or type selection number: This is similar to javac and javaws
Then check java -version
computerlabug@computerlab:/usr/bin$ java -version
bash: /usr/bin/java: No such file or directory** What I do please explain step by step
102 Answers
Your mistake is in the update-alternatives command.
It should be
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0_79/jre/bin/java" 1You've missed jre
Your javac command seem to be OK.
But the javaws is also
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0_79/jre/bin/javaws" 1To fix it run
sudo update-alternatives --remove-all java
sudo update-alternatives --remove-all javaws
sudo update-alternatives --remove-all javac
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0_79/jre/bin/java" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0_79/jre/bin/javaws" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0_79/bin/javac" 1 7 Why not install it the easy way?
This method install Java JDK, JRE and the Java browser plugin:
sudo apt-get install python-software-properties sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java7-installer
To check if the installation worked, enter the following command:
java -version