This article for those who only want to install the Oracle Java JDK
with the Oracle Java JRE included from Oracle website.
The following Instructions for how to install Oracle Java JDK on Debian based Linux operating systems such as Debian, Ubuntu and Linux Mint.
Note: you must replace "jdk1.7.0_51" by your java file version
Step 1: Check to see if your Ubuntu Linux operating system architecture is 32-bit or 64-bit, open up a terminal and run the following command below.
Step 2: Check if you have Java installed on your system. To do this, you will have to run the Java version command from terminal.
If you have OpenJDK installed on your system, you have the wrong vendor version of Java installed for this exercise
Step 3: Completely remove the OpenJDK/JRE from your system if exists
To remove OpenJDK/JRE completely from your system
Step 4: Download the Oracle Java JDK for Linux and make sure you select the correct "compressed binaries file" for your system architecture 32-bit or 64-bit (which end with .tar.gz), i.e. "[java-version]-i586.tar.gz" for 32bit and "[java-version]-x64.tar.gz" for 64bit
Step 5: Create a directory to hold your Oracle Java JDK and JRE binaries
Step 6: Move the compressed file to /usr/local/java directory
Step 7: Move current location to the new directory
Step 8: Run the following commands on the downloaded Oracle Java tar.gz files. Make sure to do this as root in order to make it executable for all users on your system. To open a root terminal type sudo -s you will be prompted for your logon password.
The following Instructions for how to install Oracle Java JDK on Debian based Linux operating systems such as Debian, Ubuntu and Linux Mint.
(The Manual Method)
Note: you must replace "jdk1.7.0_51" by your java file version
Step 1: Check to see if your Ubuntu Linux operating system architecture is 32-bit or 64-bit, open up a terminal and run the following command below.
file /sbin/init
Step 2: Check if you have Java installed on your system. To do this, you will have to run the Java version command from terminal.
java -version
If you have OpenJDK installed on your system, you have the wrong vendor version of Java installed for this exercise
Step 3: Completely remove the OpenJDK/JRE from your system if exists
To remove OpenJDK/JRE completely from your system
sudo apt-get purge openjdk-\*
Step 4: Download the Oracle Java JDK for Linux and make sure you select the correct "compressed binaries file" for your system architecture 32-bit or 64-bit (which end with .tar.gz), i.e. "[java-version]-i586.tar.gz" for 32bit and "[java-version]-x64.tar.gz" for 64bit
Step 5: Create a directory to hold your Oracle Java JDK and JRE binaries
sudo mkdir -p /usr/local/java
Step 6: Move the compressed file to /usr/local/java directory
sudo mv Downloads/jdk-7u51-linux-i586.tar.gz /usr/local/java
Step 7: Move current location to the new directory
cd /usr/local/java
Step 8: Run the following commands on the downloaded Oracle Java tar.gz files. Make sure to do this as root in order to make it executable for all users on your system. To open a root terminal type sudo -s you will be prompted for your logon password.
sudo chmod a+x jdk-7u51-linux-i586.tar.gz
Step 9: Unpack the compressed Java binaries, in the directory /usr/local/java, the remove the compressed file
sudo tar xvzf jdk-7u51-linux-i586.tar.gz sudo rm -f jdk-7u51-linux-i586.tar.gz
Step 10: Double-check your directories. At this point, you should have only uncompressed binary directory in /usr/local/java for the Java JDK/JRE listed
ls -a
Step 11: Edit the system PATH file /etc/enviroment to add the system variables to your system path. Use nano, gedit or any other text editor, as root, open up /etc/enviroment.
sudo gedit /etc/enviromentor
sudo nano /etc/enviroment
Step 12: Text Editor will popped up, Scroll down to the end of the file using your arrow keys and add the following lines below to the end of your /etc/enviroment file
JAVA_HOME=/usr/local/java/jdk1.7.0_51 PATH=$PATH:$HOME/bin:$JAVA_HOME/bin export JAVA_HOME export PATH
Step 13: Save the /etc/enviroment file and exit
Step 14: Inform your Ubuntu Linux system where is Oracle Java JDK/JRE located.
the following command notifies the system that Oracle Java JRE is available for use
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jdk1.7.0_51/bin/java" 1
the following command notifies the system that Oracle Java JDK is available for use
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk1.7.0_51/bin/javac" 1
the following command notifies the system that Oracle Java Web start is available for use
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jdk1.7.0_51/bin/javaws" 1
Step 15: Inform your Ubuntu Linux system that Oracle Java JDK/JRE must be the default Java
the following command set the java runtime environment for the system
sudo update-alternatives --set java /usr/local/java/jdk1.7.0_51/bin/java
the following command set the javac compiler for the system
sudo update-alternatives --set javac /usr/local/java/jdk1.7.0_51/bin/javac
the following command set Java Web start for the system
sudo update-alternatives --set javaws /usr/local/java/jdk1.7.0_51/bin/javaws
Step 16: Reload your enviroment variable file "/etc/enviroment" by typing the following command (notice the space after dot):
. /etc/enviroment
Step 17: Test to see if Oracle Java was installed correctly on your system. Run the following commands and note the version of Java:
The following command displays the version of java running on your system
java -version
The following command lets you know that you are now able to compile Java programs from the terminal
javac -version
Note: if you got an error like this
java cannot execute binary file
You need to ensure from version compatibility, because this problem caused when you using a x86 Ubuntu with a x86_64 JDK, you can test your ubuntu version by the following command
uname -i
Step 18: Congratulations, you have comoleted installation steps, Now reboot your Ubuntu Linux system. Afterwards, your system will be fully configured for running and developing Java programs
(The Easy Method)
The easy way to install Oracle JDK using Web Up8 Oracle Java OOS, but the PPA not always up to date, also note that using PPA is not very recommended for safty reason, read more about the dangers of using PPA
However, is you understand that and you still want to install JDK using PPA just open the terminal and type the following commands
Note: This installs JDK (which includes 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
--
http://www.wikihow.com/Install-Oracle-Java-JDK-on-Ubuntu-Linux
http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html
http://askubuntu.com/questions/56104/how-can-i-install-sun-oracles-proprietary-java-6-7-jre-or-jdk
http://rootzwiki.com/topic/23008-howto-install-java-7-on-ubuntu-1204/
http://www.liberiangeek.net/2012/04/install-oracle-java-jdk-7-in-ubuntu-12-04-precise-pangolin/
ReplyDeleteVery informative error.Thank you author for posting this kind of error .
http://www.wikitechy.com/fix-error/install-sunoracles-proprietary-java-jdk-or-jrk
Both are really good.
Cheers,
Venkat
ReplyDeleteVery informative error.Thank you author for posting this kind of error .
http://www.wikitechy.com/fix-error/install-sunoracles-proprietary-java-jdk-or-jrk
Both are really good.
Cheers,
Venkat