Home > java > Installing Sun Java JRE, JDK?

Installing Sun Java JRE, JDK?

June 13Hits:2
Advertisement

How do I install Java, including in my browser, so websites with Java work?

Answers

There are several implementations of Java. The three most common implementations when talking about it for Ubuntu are:

  • OpenJDK: The primary goal of the OpenJDK project is to produce an open-source implementation of the Java SE Platform (6 and 7). This is the default version of Java that Ubuntu uses and is the easiest to install.
  • Sun Java: Sun Java is the reference implementation for Java 6. Its support has been discontinued in Ubuntu.
  • Oracle Java: Oracle Java is the OpenJDK Java Se Platform version 7 implementation from Oracle. Oracle introduced with this implementation a license that prevents distribution.

Since Ubuntu 11.10 (Oneiric Ocelot) and due to license issues Ubuntu will no longer distribute Oracle's JDK and JRE. Also, previous versions supplied on PPAs suffer from security issues and are not recommended to be installed on any Ubuntu system.

There are no more supported .deb releases from Ubuntu with reference to Sun Java or Oracle Java, Ubuntu officially supports OpenJDK and OpenJRE implementation of Java which is the base for Oracle's own implementation.

OpenJRE is the official implementation of Java Runtime Environment (JRE) for your Ubuntu systems and should suffice to run any Java program that you might require and it's included in the main repository and it's easily installable.

OpenJRE

Installing Sun Java JRE, JDK?

Or by opening a terminal and typing

sudo apt-get install openjdk-7-jre

The openjdk-7-jre package contains just the Java Runtime Environment. If you want to develop Java programs then install the openjdk-7-jdk package:

Installing Sun Java JRE, JDK?



Also important is to install the wrapper for supporting Java applications on your web browser, the Iced-Tea Java Plugin.

IcedTea Plugin

Installing Sun Java JRE, JDK?

Or via a terminal

sudo apt-get install icedtea-plugin

Or look for icedtea-plugin in the Ubuntu Software Center.



To make sure that you are running the correct version of Java, use this command to set your choice:

sudo update-alternatives --config java

java -version should display the choice you previously made.



If you need to install OpenJDK-JRE 6 or OpenJDK-JDK 6

openjdk-6-jre (click to install) is available for installation for Ubuntu 8.04 (Hardy Heron) and up.

Install it with

sudo apt-get install openjdk-6-jre

Or if you need the developers' package, openjdk-6-jdk (click to install), install it with:

sudo apt-get install openjdk-6-jdk

A version of the icedtea-plugin (click to install) is also available to install if you are going to use OpenJDK 6.

Install it with:

sudo apt-get install icedtea6-plugin



If you really want to use Oracle's Java SE Platform, see How can I install Sun/Oracle's proprietary Java JDK 6/7/8 or JRE?.

Installing OpenJDK is not enough for enabling Java in browsers. You'll also need to install the icedtea-7-plugin package:

Installing Sun Java JRE, JDK?

A restart of the browser might be required.

For installing Oracle Java 7:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo mkdir -p /usr/lib/mozilla/plugins #just in case, this will be added to the package in the next version
sudo apt-get install oracle-jdk7-installer

  • Are "PPA's" safe to add to my system, and what are some "red flags" to watch out for?

Installing OpenJDK - Recommended

The simplest way to install Java on Ubuntu is to use OpenJDK. This will work fine for most people. To install it, click on the small button with the Ubuntu logo on it, as shown in the screenshot below.

Installing Sun Java JRE, JDK?

After opening the Dash Home, you need to type in Terminal. Click on the icon that is circled in the screenshot below.

Installing Sun Java JRE, JDK?

This will open the Terminal, which is Ubuntu's version the the Windows Command prompt, though the Terminal has many more features. Now, copy and paste the following command into the Terminal window. You will need to use ControlShiftV to paste text into the terminal.

sudo apt-get install -y openjdk-7-jre openjdk-7-jdk

You will need to enter your password to use this command. Although it will not show up in the Terminal, it will still be entered when you type it. After running this command, you will be set up to run and develop Java applications.

Installing Oracle Java

OpenJDK works fine for most people, but if you play Minecraft, you will want to use Oracle Java instead. To install Oracle Java, run the command below one at a time in the Terminal.

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

This will download Java from Oracle's website, and install it for you.

  • Are "PPA's" safe to add to my system, and what are some "red flags" to watch out for?

Open your terminal with Ctrl+Alt+T and:

Now this will install the latest Java version

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

Oracle Java 8 was just released (stable). To install it in Ubuntu, you can use the WebUpd8 Java PPA:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

The PPA itself doesn't provide Oracle Java 8 binaries (that's not allowed by the Oracle Java license). Instead, an installer is used that automatically downloads and installs Oracle Java 8. Using this PPA, you'll also receive automatic Java 8 updates.

More information and some tips on using / further configuring Oracle Java 8 @ WebUpd8 is in Install Oracle Java 8 In Ubuntu Via PPA Repository [JDK 8].

Unfortunately, because of issues with its license, Oracle Java is no longer distributed within the official Ubuntu repositories. You have two main options: either try OpenJDK -- an open source replacement for Oracle Java -- or proceed with the "manual" installation (which is exactly what you were trying to do). Both these options are described on the help wiki: https://help.ubuntu.com/community/Java. This page also include some other alternatives that, depending on your needs, you may find more suitable.

Just a side note: most of the time, with Ubuntu, you should not download software from the Internet, but rather use the Ubuntu Software Center. The software you'll find there is ensured to be stable, safe and to respect the standard conventions of the system. Oracle Java is just an exception to this rule.

Just go to Aplications --> Ubuntu software center and then search for Java. Installing Sun Java JRE, JDK?

There are a few ways to install Java in Ubuntu:

Install OpenJDK (The open source equivalent to Sun's Java) directly from Ubuntu Software Center. All you need to do is search for Java. That tends to work as is for me.

If you need Sun's Java, say if you want to play Minecraft, you download the JRE as you described from Java.com, but make sure your .bin-file can be executed. You do that by opening a terminal and typing the following (I will assume you have it in your Downloads folder so change the cd line accordingly if that's not where it is):

cd /home/user/Downloads
sudo chmod +x jre-6u31-linux-i586.bin

Then, you should be able to close your terminal, right click on your .bin-file and select "Execute", which should run the installer. If this is not an option, just do the following from terminal (in the same folder as the two other actions):

./jre-6u31-linux-i586.bin

That simply runs the specified file and if you successfully typed in the two first lines, the installation.

# current java release - get both jdk / jre download here

sudo mkdir /usr/local/java

cd /usr/local/java

# remove previous installs if any

sudo rm -rf /usr/local/java/jdk*
sudo rm -rf /usr/local/java/jre*

# move downloaded/expanded dirs into /usr/local/java

sudo mv ~/jdk* /usr/local/java/
sudo mv ~/jre* /usr/local/java/

cd /usr/local/java/

# create symbolic links

sudo ln -s jdk*  jdk
sudo ln -s jre*  jre

# ONLY need to do below on fresh ubuntu install - IGNORE if previously installed any java version as its already in place

# setup symlinks :

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jre/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jre/bin/javaws" 1
sudo update-alternatives --set java /usr/local/java/jre/bin/java
sudo update-alternatives --set javac /usr/local/java/jdk/bin/javac
sudo update-alternatives --set javaws /usr/local/java/jre/bin/javaws

Finally, put these in your ~/.bashrc

export JAVA_HOME=/usr/local/java/jdk
export PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JRE_HOME=/usr/local/java/jre
export PATH=$PATH:$HOME/bin:$JRE_HOME/bin

now you're locked and loaded ;-)

If you are missing Java in Firefox, then

plug=~/.mozilla/plugins/libnpjp2.so &&
test -e $plug && readlink -f $plug ||
  ln -f -s `find ~ -wholename '*jdk*lib*libnpjp2.so' -or -wholename '*jre*lib*libnpjp2.so' | head -n 1` `dirname $plug` &&
ls -la $plug

This script will overwrite libnpjp2.so even if it exists, but points to wrong file (for example, the symlink is broken).

I made a text-based Java installer using terminal commands. It uses wget, tar, update-alternatives, and ln. It will install the Oracle JRE with the Firefox plugin.

You can download the installer from Google Drive here. Then put it in your home folder, open Terminal and type bash Install. Then it will run the installer in Terminal. It uses sudo, so you will need to type your password after it downloads. Also, this is the 64-bit version, so I will add the 32 bit later.

As of now ( 2015-11-28 ) there is no official package for Java 8 from OpenJDK ( the open source version ), but you can install it via this PPA by running:

$> sudo add-apt-repository ppa:openjdk-r/ppa
$> sudo apt-get update
$> sudo apt-get install openjdk-8-jdk

[3]: sudo apt-get install openjdk-8-jdk

Tags:java, openjdk

Related Articles

  • Installing Sun Java JRE, JDK?

    Installing Sun Java JRE, JDK? June 13

    How do I install Java, including in my browser, so websites with Java work? --------------Solutions------------- There are several implementations of Java. The three most common implementations when talking about it for Ubuntu are: OpenJDK: The prima

  • How to install Sun Java JRE (or JDK) on Ubuntu 10.04?March 9

    I've followed a variety of instructions about modifying my sources.list trying to install Sun's JRE for Java 6 with no luck. The defining error I'm getting appears to be package sun-java6-jdk is virtual. How do I install sun-java6-jre on Ubuntu 10.04

  • How to install sun java 6 jdk and jre to Ubuntu 12.04

    How to install sun java 6 jdk and jre to Ubuntu 12.04 October 17

    This question already has an answer here: How can I install Sun/Oracle's proprietary Java JDK 6/7/8 or JRE? 25 answers Most of the software is not thoroughly tested with Java 7 and I would like to install Oracle's JDK 6.0 on Ubuntu 11.10. Could someo

  • How can I install the latest version of Sun Java (JRE)?

    How can I install the latest version of Sun Java (JRE)? August 7

    I want to install Oracle's JRE and to update to the latest version with the Software Updater when they released. Is there a Ubuntu package that is provided by Canonical or Oracle? Before release Java 7, I followed this way to install Java 6. But it d

  • How do I install the latest Sun Java JRE on Ubuntu Server 9.10?February 10

    Unfortunately, if I try to install sun-java via apt-get, it's not found in the repositories. # apt-get install sun-java6-jre Reading package lists... Done Building dependency tree Reading state information... Done Package sun-java6-jre is not availab

  • How can I install Sun Java JDK 6 on Debian?May 25

    If I try to install Sun Java JDK 6 on Debian, it doesn't install it. I don't want to install OpenJDK, because it doesn't work always exactly same as Sun JDK. I use following command: apt-get install sun-java6-jdk Package name should be correct, see l

  • How To Install Sun Java SE 6 JDK and NetBeans 5.5.1 on Fedora 7

    How To Install Sun Java SE 6 JDK and NetBeans 5.5.1 on Fedora 7May 17

    How To Install Sun Java SE 6 JDK and NetBeans 5.5.1 - Fedora 7 Version 1.0 Author: Tomo Popovic (tpop2005 [at] yahoo.com) This tutorial shows how to install Sun Java JDK and NetBeans IDE on the fresh Fedora 7 installation. The readers I had in mind w

  • Install Oracle Java JRE 7 on Ubuntu with just the command lineAugust 17

    I can't use openjdk because it doesn't have native .jpg support. I can't use sudo apt-get install sun-java6-jre sun-java6-plugin any more because apparently those have been pulled. JRE version 7 works, but the only way I've found to get it is to acce

  • automatically agree to license agreement when using "apt-get install sun-java6-jre"March 4

    i am creating a slient setup script on an ubuntu machine that also installs additional packages. one problem i am having is that the sun java package needs a manual confirmation of the license agreement. is there a chance that i can automate the inst

  • Installing Sun Java on Fedora 14December 28

    How do you install Sun Java on Fedora 14, instead of the default OpenJDK? --------------Solutions------------- Go to http://www.oracle.com/technetwork/java/javase/downloads/index.html Download JDK Choose Linux x64 for Platform Download the RPM jdk-6u

  • install sun java 6 and sun java 7 side-by-side on linux (fedora 16) using rpmFebruary 12

    This is what I would like to achieve, but I'm failing (I'm a newbie in Linux). I have a Fedora 16 box (64 bit) and would like to install multiple versions of oracle java (java 6 and java 7 for the moment). I'm trying to install java using the rpm sof

  • Manually installing Sun Java and Debian/Ubuntu virtual java packagesMay 10

    I've installed Sun Java 6 manually since Canonical has removed it from its package repo (I use Ubuntu 12.04). Now I have the following problem: when I want to install a package which depends on Java via a virtual Java packages (java2-runtime or defau

  • Installed Sun Java 6 - configuration problem when running as sudoJanuary 7

    I have install Sun Java 6 on an Ubuntu server and set an environment variable in the default profile as per the instructions at http://www.edugate.ie/workshop-guides/shibboleth-2-identity-provider-installation-linux-debian-or-ubuntu I then try to run

  • How can I uninstall my current java and install sun java 1.6February 9

    I installed jdk using the following command: sudo apt-get install default-jdk but it is the wrong version. I need Java SE 1.6 for building Android. When I try building Android, I get a message: Checking build tools versions... You are attempting to b

  • How to install Sun Java jdk 6 on Ubuntu? December 26

    Possible Duplicate: How do I install Oracle JDK 6? The issue has been posted in various sites, but didn't get any of them working for me. Who can help me? I followed the instructions at https://help.ubuntu.com/community/Java for Java 6. Ubuntu versio

  • Installing Sun Java (JDK), NetBeans IDE and LAMP on Fedora 15February 9

    If you can, please submit an article on installing/ configuring latest versions of the following tools like a "newbie" on Fedora 15 desktop version: 1. Sun Java (JDK) w/ how to setting up PATH variable if needed 2. NetBeans IDE 3. LAMP (Apache,

  • "HtmlConverter doesn't exist." error when installing Sun Java 6 July 30

    I'm new to Ubuntu and Java. How do I correct this? [email protected]:~$ sudo apt-get install sun-java6-jdk Reading package lists... Done Building dependency tree Reading state information... Done The following packages were autom

  • Installing Oracle Java JRE 7, Terminal Command Not Recognizing Moved FileDecember 16

    I'm having a small problem. I've been trying to work Minecraft into working using Wine. Over the past few hours, I've been working with Java over and over (long story, I'll keep it relevant) and have finally come to an answer. I need to install Oracl

  • How do I upgrade Sun Java (JRE) on Ubuntu 11?March 7

    On Ubuntu I've installed the Sun JRE from http://ppa.launchpad.net/ferramroberto/java/ubuntu oneiric and am at Version 6 update 26. (Outlined in the accepted answer here) I downloaded the bin file for Version 6 update 31 but don't know how to update

  • How can i install sun java to Fedora 8May 24

    I want to install java on my Fedora 8 server but come to the step 9 that is mentioned in this guide but at step 10 when I enter this command: ln -s /opt/jre1.6.0_18/plugin/i386/ns7/libjavaplugin_oji.so /usr/lib/mozilla/plugins/libjavaplugin_oji.so it

Copyright (C) 2018 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.572 s.