How To Manually Install Oracle Java on Ubuntu
2014-05-24 19:13
741 查看
Introduction
Java is a programming technology originally developed by Sun Microsystems and later acquired by Oracle. Oracle Java is a proprietary implementation for Java that is free to download and use for commercial use, but not to redistribute, therefore it is not included in a officially maintained repository.There are many reasons why you would want to install Oracle Java over OpenJDK. In this tutorial, we will not discuss the differences between the above mentioned implementations.
Assumptions
This tutorial assumes that you have an account with DigitalOcean, as well as a Droplet running Debian 7 or Ubuntu 12.04 or above. You will need root privileges (via sudo) to complete the tutorial.You will need to know whether you are running a 32 bit or a 64 bit OS:
i46614161@i46614161:/usr/local/java/jdk1.8.0_05$ uname -m i686
x86_64: 64 bit kernel
i686: 32 bit kernel
Downloading Oracle Java JDK
Using your web browser, go to the Oracle Java SE (Standard Edition) website and decide which version you want to install:JDK: Java Development Kit. Includes a complete JRE plus tools for developing, debugging, and monitoring Java applications.
Server JRE: Java Runtime Environment. For deploying Java applications on servers. Includes tools for JVM monitoring and tools commonly required for server applications.
In this tutorial we will be installing the JDK Java SE Development Kit 8 x64 bits. Accept the license and copy the download link into your clipboard. Remember to choose the right tar.gz (64 or 32 bits). Use wget to download the archive into your server:
wget --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u5-b13/jdk-8u5-linux-i586.tar.gz[/code]
Oracle does not allow downloads without accepting their license, therefore we needed to modify the header of our request. Alternatively, you can just download the compressed file using your browser and manually upload it using a SFTP/FTP client.
Always get the latest version from Oracle's website and modify the commands from this tutorial accordingly to your downloaded file.
Or U can visit the website directly and download the tar.gz file do not visa the command .Installing Oracle JDK
In this section, you will need sudoprivileges:sudosudomkdir -p /usr/local/javacd /home/"your_user_name"/Downloads
sudocp -r jdk-8u5-linux-i586.tar.gz /usr/local/java/
cd /usr/local/java
sudotar xvzf jdk-8u5-linux-i586.tar.gzSetting Oracle JDK as the default JVM
In our case, the java executable is located under /usr/local/java/jdk1.8.0_05/bin/java . To set it as the default JVM in your machine run:sudo update-alternatives --install /usr/bin/java java /usr/local/java/jdk1.8.0_05/bin/java 100
sudoupdate-alternatives --install /usr/bin/javac javac /usr/local/java/jdk1.8.0_05/bin/javac 100sudoupdate-alternatives --install /usr/bin/javaws javaws /usr/local/java/jdk1.8.0_05/bin/javaws 100Verify your installation
Verify that java has been successfully configured by running:update-alternatives --display javaupdate-alternatives --display javac
The output should look like this:java - auto mode link currently points to /usr/local/java/jdk1.8.0_05/bin/java /usr/local/java/jdk1.8.0_05/bin/java - priority 100 Current 'best' version is '/usr/local/java/jdk1.8.0_05/bin/java'.javac - auto mode link currently points to /usr/local/java/jdk1.8.0_05/bin/javac /usr/local/java/jdk1.8.0_05/bin/javac - priority 100 Current 'best' version is '/usr/local/java/jdk1.8.0_05/bin/javac'.
Another easy way to check your installation is:java -version
After installation is complete, set environment variables as follows
Edit the system Path file /etc/profilesudogedit /etc/profile
Add following lines in endJAVA_HOME=/usr/local/java/jdk1.8.0_05 PATH=$PATH:$HOME/bin:$JAVA_HOME/bin export JAVA_HOME export PATH
Note:The environment variables modifiy will active after you logout or reboot system .
相关文章推荐
- How to Install Oracle Java JDK 6/7/8 on Ubuntu 13.04 / 12.10 / 12.04
- How to Install Oracle Java on Ubuntu Linux
- How to Install Oracle Java JDK on Ubuntu Linux
- how to install the Oracle Java (JDK) 8, Oracle Java (JDK + JRE) 7 or Oracle Java (JDK) 6 on Ubuntu 1
- How to Install Oracle Java JDK on Ubuntu Linux
- How to Install Oracle Java JDK on Ubuntu Linux
- How to Install Oracle Java JDK on Ubuntu Linux
- How to Install JAVA on Ubuntu
- How to install sun-java5-jdk on Ubuntu 10.04
- how to install oracle jdk 7 on ubuntu lucid lts 10.04
- How to install Sun Java 1.5 on Ubuntu 10.04
- How to Install Oracle VirtualBox 5.1 on Ubuntu 16.04 & 15.10 and Debian 8/7
- ubuntu――How to Install Oracle Java JDK8
- How To Install Oracle Java 7 (JDK) In Ubuntu
- How To Install Java on Ubuntu with Apt-Get
- How To Install Java on Ubuntu with Apt-Get
- How to install sun-java5-jdk on Ubuntu 9.10
- [转载] How to install oracle java 7 in ubuntu 13.04/12.10/12.04
- How To Install Java on Ubuntu with Apt-Get
- How to install Sun Java 1.5 on Ubuntu 10.04