Feb 28, 2014 - This simple tutorial is going to show you how to easily install Oracle Java (JDK) 6, 7, or 8 in Ubuntu 14.04 Trusty Tahr via PPA. Install Oracle Java JDK 7 in Ubuntu 12.04 (Precise Pangolin) Last week we showed you how to install Oracle Java Runtime Environment (JRE) in Ubuntu 12.04. To read that post, click here.
Introduction I had installed JDK 6.0 update 31 in an earlier post. However, I now need to write a Java application that requires the features available in JDK 7. In this post, I will install JDK 7 update 5 as a secondary JDK, while JDK 6.0 u31 will be the primary JDK.
It’s perfectly normal to have multiple JDKs on a single machine to support the requirements of different applications. Fortunately, it’s easy to use a different JDK on a per application basis. Download I have a 64 bit version of Ubuntu 12.04 LTS installed, so the instructions below only apply to this OS. Download the Java JDK from. Click Accept License Agreement.
Click dk-7u5-linux-x64.tar.gz. Login to Oracle.com with your Oracle account. Download the JDK to your /Downloads directory. After downloading, open a terminal, then enter the following commands. Installation Open a terminal, then enter the following commands: cd /Downloads tar -xzf jdk-7u5-linux-x64.tar.gz Note: The jvm directory is used to organize all JDK/JVM versions in a single parent directory. As this is our 2nd JDK, we’ll assume that the jvm directory already exists.
Sudo mv jdk1.7.005 /usr/lib/jvm The next 3 commands are split across 2 lines per command due to width limits in the blog’s theme. Sudo update-alternatives -install '/usr/bin/java' 'java' '/usr/lib/jvm/jdk1.7.005/bin/java' 2 sudo update-alternatives -install '/usr/bin/javac' 'javac' '/usr/lib/jvm/jdk1.7.005/bin/javac' 2 sudo update-alternatives -install '/usr/bin/javaws' 'javaws' '/usr/lib/jvm/jdk1.7.005/bin/javaws' 2 sudo update-alternatives -config java You will see output similar to the following (although it’ll differ on your system). Read through the list and find the number for the Oracle JDK installation (/usr/lib/jvm/jdk1.7.005/bin/java) There are 2 choices for the alternative java (providing /usr/bin/java). Selection Path Priority Status -. 0 /usr/lib/jvm/jdk1.7.005/bin/java 2 auto mode 1 /usr/lib/jvm/jdk1.6.031/bin/java 1 manual mode 2 /usr/lib/jvm/jdk1.7.005/bin/java 2 manual mode Press enter to keep the current choice., or type selection number: On my system I did entered 1 to keep JDK 1.6.0 u31 as my primary JDK (change the number that is appropriate for your system). To enter 1, press 1 on the keyboard, then press Enter. Sudo update-alternatives -config javac There are 2 choices for the alternative javac (providing /usr/bin/javac).
Selection Path Priority Status -. 0 /usr/lib/jvm/jdk1.7.005/bin/javac 2 auto mode 1 /usr/lib/jvm/jdk1.6.031/bin/javac 1 manual mode 2 /usr/lib/jvm/jdk1.7.005/bin/javac 2 manual mode Press enter to keep the current choice., or type selection number: I entered 1 then pressed Enter to keep JDK 1.6.0 u31 as my primary javac command.
Sudo update-alternatives -config javaws There are 2 choices for the alternative javaws (providing /usr/bin/javaws). Selection Path Priority Status -. 0 /usr/lib/jvm/jdk1.7.005/bin/javaws 2 auto mode 1 /usr/lib/jvm/jdk1.6.031/bin/javaws 1 manual mode 2 /usr/lib/jvm/jdk1.7.005/bin/javaws 2 manual mode Press enter to keep the current choice., or type selection number: I entered 1 then pressed Enter to keep JDK 1.6.0 u31 as my primary javaws command. As a final step, let’s test each of the commands to ensure everything is setup correctly. Java -version The output should be: java version '1.6.031' Java(TM) SE Runtime Environment (build 1.6.031-b04) Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode) javac -version The output should be: javac 1.6.031 javaws -version The output should be: Java(TM) Web Start 1.6.031, which is followed by a long usage message.
That’s it, the JDK 7 u5 is installed.
Introduction I had installed JDK 6.0 update 31 in an earlier post. However, I now need to write a Java application that requires the features available in JDK 7.
In this post, I will install JDK 7 update 5 as a secondary JDK, while JDK 6.0 u31 will be the primary JDK. It’s perfectly normal to have multiple JDKs on a single machine to support the requirements of different applications.
![Install Oracle Java Jdk 7 Ubuntu 12.04 Install Oracle Java Jdk 7 Ubuntu 12.04](/uploads/1/2/5/3/125356058/849485523.jpg)
Fortunately, it’s easy to use a different JDK on a per application basis. Download I have a 64 bit version of Ubuntu 12.04 LTS installed, so the instructions below only apply to this OS. Download the Java JDK from. Click Accept License Agreement. Click dk-7u5-linux-x64.tar.gz. Login to Oracle.com with your Oracle account. Download the JDK to your /Downloads directory.
After downloading, open a terminal, then enter the following commands. Installation Open a terminal, then enter the following commands: cd /Downloads tar -xzf jdk-7u5-linux-x64.tar.gz Note: The jvm directory is used to organize all JDK/JVM versions in a single parent directory. As this is our 2nd JDK, we’ll assume that the jvm directory already exists. Sudo mv jdk1.7.005 /usr/lib/jvm The next 3 commands are split across 2 lines per command due to width limits in the blog’s theme. Sudo update-alternatives -install '/usr/bin/java' 'java' '/usr/lib/jvm/jdk1.7.005/bin/java' 2 sudo update-alternatives -install '/usr/bin/javac' 'javac' '/usr/lib/jvm/jdk1.7.005/bin/javac' 2 sudo update-alternatives -install '/usr/bin/javaws' 'javaws' '/usr/lib/jvm/jdk1.7.005/bin/javaws' 2 sudo update-alternatives -config java You will see output similar to the following (although it’ll differ on your system). Read through the list and find the number for the Oracle JDK installation (/usr/lib/jvm/jdk1.7.005/bin/java) There are 2 choices for the alternative java (providing /usr/bin/java). Selection Path Priority Status -.
0 /usr/lib/jvm/jdk1.7.005/bin/java 2 auto mode 1 /usr/lib/jvm/jdk1.6.031/bin/java 1 manual mode 2 /usr/lib/jvm/jdk1.7.005/bin/java 2 manual mode Press enter to keep the current choice., or type selection number: On my system I did entered 1 to keep JDK 1.6.0 u31 as my primary JDK (change the number that is appropriate for your system). To enter 1, press 1 on the keyboard, then press Enter. Sudo update-alternatives -config javac There are 2 choices for the alternative javac (providing /usr/bin/javac). Selection Path Priority Status -. 0 /usr/lib/jvm/jdk1.7.005/bin/javac 2 auto mode 1 /usr/lib/jvm/jdk1.6.031/bin/javac 1 manual mode 2 /usr/lib/jvm/jdk1.7.005/bin/javac 2 manual mode Press enter to keep the current choice., or type selection number: I entered 1 then pressed Enter to keep JDK 1.6.0 u31 as my primary javac command. Sudo update-alternatives -config javaws There are 2 choices for the alternative javaws (providing /usr/bin/javaws).
Selection Path Priority Status -. 0 /usr/lib/jvm/jdk1.7.005/bin/javaws 2 auto mode 1 /usr/lib/jvm/jdk1.6.031/bin/javaws 1 manual mode 2 /usr/lib/jvm/jdk1.7.005/bin/javaws 2 manual mode Press enter to keep the current choice., or type selection number: I entered 1 then pressed Enter to keep JDK 1.6.0 u31 as my primary javaws command. As a final step, let’s test each of the commands to ensure everything is setup correctly. Java -version The output should be: java version '1.6.031' Java(TM) SE Runtime Environment (build 1.6.031-b04) Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode) javac -version The output should be: javac 1.6.031 javaws -version The output should be: Java(TM) Web Start 1.6.031, which is followed by a long usage message. That’s it, the JDK 7 u5 is installed.