- Download jdk-7u10-linux-i586.tar.gz from http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
- Download jre-7u10-linux-i586.tar.gz from http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1880261.html
- The downloaded files may be stored in /home/"your_user_name"/Downloads directory
- Remove any oracle jdk/jre binaries if any already installed
sudo apt-get purge openjdk-\* - Create directory to hold Oracle Java JDK and JRE binaries
sudo mkdir -p /usr/local/java
- Go to the directory where the downloaded files are stored
cd /home/"your_user_name"/Downloads - Copy the downloaded files into /usr/local/java and go into the directory and change the permissions
sudo -s cp -r jdk-7u10-linux-i586.tar.gz /usr/local/javasudo -s cp -r jre-7u10-linux-i586.tar.gz /usr/local/javacd /usr/local/javasudo -s chmod a+x jdk-7u10-linux-i586.tar.gzsudo -s chmod a+x jre-7u10-linux-i586.tar.gz - Extract the compressed binaries
sudo -s tar xvzf jdk-7u10-linux-i586.tar.gzsudo -s tar xvzf jre-7u10-linux-i586.tar.gz - Now the listing of the extracted files can be viewed by:
ls -a - Edit the system PATH file /etc/profile and add the following system variables to the system path
sudo gedit /etc/profile - Add the following lines to the end of /etc/profile file
JAVA_HOME=/usr/local/java/jdk1.7.0_10 PATH=$PATH:$HOME/bin:$JAVA_HOME/bin JRE_HOME=/usr/local/java/jre1.7.0_10 PATH=$PATH:$HOME/bin:$JRE_HOME/bin export JAVA_HOME export JRE_HOME export PATH - Save the /etc/profile file and exit
- Inform your Ubuntu Linux system where your Oracle Java JDK/JRE is located. This will tell the system that the new Oracle Java version is available for use.
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jre1.7.0_10/bin/java" 1sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk1.7.0_10/bin/javac" 1sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jre1.7.0_10/bin/javaws" 1 - Inform your Ubuntu Linux system that Oracle Java JDK/JRE must be the default Java.
sudo update-alternatives --set java /usr/local/java/jre1.7.0_10/bin/javasudo update-alternatives --set javac /usr/local/java/jdk1.7.0_10/bin/javacsudo update-alternatives --set javaws /usr/local/java/jre1.7.0_10/bin/javaws - Reload your system wide PATH /etc/profile by typing the following command:
. /etc/profile - Note your system-wide PATH /etc/profile file will reload after reboot of your Ubuntu Linux system
- Test to see if Oracle Java was installed correctly on your system. Run the following commands and note the version of Java:
java -versionjavac -version
Wednesday, December 26, 2012
Install Oracle Java in Ubuntu
These steps are for installing java on a 32 bit ubuntu/linux OS.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment