Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the hueman domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/CloudIngenium.com/htdocs/wp-includes/functions.php on line 6114
How to: Install Java JRE on an Ubuntu computer – Knowledge eXchange

How to: Install Java JRE on an Ubuntu computer

How to: Install Java JRE on an Ubuntu computer

There were the good old days when everyone was friends with everyone. MySQL was own by people committed to open source, Sun Microsystems was still around developing Java for the world, and the Linux community was thriving. Fastfoward 2013 and you’ve got Sun Microsystems buying MySQL. Then Sun gets bought over by Oracle and now the world is fearful. MySQL might get killed by Oracle as it is a leading competing product of their crown jewels and Java is now also part of Oracle which decided to not renew the distribution license it had granted several Linux distributions. So where does this leave us? You need to manually install Java on a Linux computer if you want to use it, no more apt-get, etc.

There are a few options to get JRE on your Ubuntu computer as detailed below:


Option I: Duinsoft’s distribution

Good news is that there is always a workaround. To install Oracle 7 JRE you can follow these steps:

  1. Indicate the system were it can get the package and future updates
    • sudo echo deb http://www.duinsoft.nl/pkg debs all >> /etc/apt/sources.list.d/duinsoft.list
  2. Import the gpg key with the following command:
    • sudo apt-key adv –keyserver keys.gnupg.net –recv-keys 5CB26B26
  3. Get Latest Updates
    • sudo apt-get update
  4. And install the Java package!
    • sudo apt-get install update-sun-jre

You can find this instructions from the package source at: http://www.duinsoft.nl/packages.php?t=en. You can find more information there as well as other useful commands like: apt-get download update-sun-jre (just download but do not install) and sudo ./update-sun-jre -v remove (to remove if you decide so at a later date). The Ubuntu site also has a wiki were you can read more if you want to install other versions of java (like for a webserver, etc): https://help.ubuntu.com/community/Java


Option II: Use the open source java community supported version

This might be the easiest approach for many. All you need to do is an apt-get install and select any of the openjdk packages available depending on the version you are looking for. Generally most users will find that OpenJDK is almost a drop in replacement for Oracle’s Java. There is a JRE version as well and is updated regularly by the community.

You can find the JRE and the JDK available from OpenDJK:

  • Java 6
    • openjdk-6-jre
    • openjdk-6-jdk
  • Java 7
    • openjdk-7-jre
    • openjdk-7-jdk

Option III: Use Oracle’s Java

I obviously thought this was going to be a pain and a lot of compile, make, configure, re-do would be involved but it seems it is far easier than what I expected. The instructions on the Oracle site are a bit lacking but fear not, it is a rather simple process. The only caveat I see with this is that you need to perform manual updates and keeping up with that might be a hassle. There are distributions out there like Web Update (https://launchpad.net/~webupd8team/+archive/java).

If you wish to proceed and install it manually instructions are available on the Java.com website: https://www.java.com/en/download/help/linux_x64_install.xml although they are quite plain:

  1. Change to the directory in which you want to install. Type:cd <directory path name>For example, to install the software in the /usr/java/ directory, Type:cd /usr/java/Note about root access: To install Java in a system-wide location such as /usr/local, you must login as the root user to gain the necessary permissions. If you do not have root access, install Java in your home directory or a subdirectory for which you have write permissions.

  2. Move the .tar.gz archive binary to the current directory.

  3. Unpack the tarball and install Javatar zxvf jre-7u7-linux-x64.tar.gzThe Java files are installed in a directory called jre1.7.0_07 in the current directory. In this example, it is installed in the /usr/java/jre1.7.0_07 directory. When the installation has completed, you will see the word Done.

  4. Delete the .tar.gz file if you want to save disk space.

I have proceeded to extend those instructions to cover the areas I thought were a bit lacking:

  1. Download the latest version from the official site: https://www.java.com/en/download/linux_manual.jsp
  2. Decide where you want to install and extract the contents there:
    /usr/lib/jvm/jre1.7.0_07
  3. Configure the system so that it knows where to find java (this is what I feel the Oracle instructions were lacking):
    sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jre1.7.0_07/bin/java 0
  4. This indicates that a new version of “java” is available. If you have multiple java versions installed you need to configure the order of preference like this:
    sudo update-alternatives --config java
  5. You’re done!
  6. If you are installing the JDK you’ll need to confiure java, javac and javaws:
    1. sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0.07/bin/java" 1
    2. sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0.07/bin/javac" 1
    3. sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0.07/bin/javaws" 1
  7. You might need to configure the file ownership and permissions on the executables as well:
sudo chmod a+x /usr/bin/java 
sudo chmod a+x /usr/bin/javac 
sudo chmod a+x /usr/bin/javaws
sudo chown -R root:root /usr/lib/jvm/jdk1.7.0.07

Alternatively you could use the webup8 team’s ppa to install java. Note there are dangers in using a PPA.

  1. Add their repository:
    sudo add-apt-repository ppa:webupd8team/java
  2. Update the available packages:
    sudo apt-get update
  3. Install Java:
    sudo apt-get install oracle-java7-installer
  4. Verify it was successful:
    java -version
Enhanced by Zemanta

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.