Howto install Sun Java Runtime Environment (JRE) in Ubuntu 10.04 (Lucid Lynx)

Sponsored Link
Java is an object-oriented programming language developed by Sun Microsystems in the early 1990s. Java applications are compiled to bytecode, which at runtime is either interpreted or compiled to native machine code for execution.
The language itself derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities. JavaScript, a scripting language, shares a similar name and has similar syntax, but is not directly related to Java.

We have already posted about sun java was moved to the Partner repository in Ubuntu 10.04 (Lucid)

Procedure to follow

Open terminal and run the following commands

Add partner repository using the following command

sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"

Update the source list

sudo apt-get update

Now install sun java packages using the following commands

sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts

The above command will download all the required packages and begins the installation, you’ll get a screen that contains the Sun Operating System Distributor License for Java and hit Enter to continue.

You’ll see a dialog that asks you if you agree with the DLJ license terms. Select Yes, and hit Enter; the JRE will finish installing.

Testing Java Runtime Environment

You’ll want to confirm that your system is configured properly for Sun’s JRE. This is a two-step process.

First, check that the JRE is properly installed by running the following command from a terminal.

java -version

Sponsored Link

You may also like...

127 Responses

  1. Colby says:

    @Robert Seetzen thanks man i was getting frustrated

  2. Roger WIlliams says:

    Am I missing something? The Testing section says there is a two step process, but only one (java -version) is shown

  3. chuck says:

    Thank You Guys!!

  4. Anna says:

    Lol. I’m with you Roger… Feels a little cut short considering….

  5. Witch says:

    I am still getting an error.
    Error: need a repository as argument

    All I did was copypasta. Is there something else that I might be missing?

  6. noob says:

    Thanks for this!

    Witch: The quote marks don’t go through clip board properly. You’ll need to write them manually.

  7. Nadeem says:

    Thanks for the help…

    @Witch you may need to type the command manually because the inverted commas “” are not copied correctly.

  8. Witch says:

    Thx. It finally worked after me messing with it for days. I appreciate the help.

  9. Steve Hemingway says:

    Great stuff. I tested by going to http://www.java.com/en/download/help/testvm.xml

    which confirms that I have Sun Java and the latest version.

    Thanks guys!

  10. David says:

    Argh! This fails for me.

    ###
    david@david-netbook:~/SyncDocs-0.6.7$ sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Package sun-java6-jre is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source
    E: Package sun-java6-jre has no installation candidate
    ###

    What am I doing wrong? :S

  11. Javier says:

    There is a missprint when adding ubuntu partner repository.
    sudo add-apt-repository “deb http://archive.canonical.com/ubuntu lucid partner”
    Thanks,

  12. Mel says:

    Every time I run sudo apt-get update I get an error:
    “malformed line 54 in source list /etc/apt/sources.list (dist parse)”

    I know absolutely nothing about Linux (just installed it today), so any help would be appreciated.

  13. Frank Boxall says:

    I followed instruction below. When I get to the license screen and hit enter nothing happens. So I cannot agree and the installation will not finish. How do I get out of this bind?

    sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts

    The above command will download all the required packages and begins the installation, you’ll get a screen that contains the Sun Operating System Distributor License for Java and hit Enter to continue.

    You’ll see a dialog that asks you if you agree with the DLJ license terms. Select Yes, and hit Enter; the JRE will finish installing.

  14. Colin says:

    To add the repository, you can also go:
    System -> Administration -> Software Sources
    Then click on the “Other Sources” tab. Then just check the box of the ‘http://archive.canonical.com/ubuntu lucid partner’ option, then click close. it will reload and be usable.

  15. Ekman says:

    Thanks Colin! That did it, though I had to change to the main server, since my default server was apparently down…

  16. Lawrence says:

    Hey Frank Boxall I’m a complete newbe. I got the same error. SOLUTION: Randomly I selected Terminal > Reset; that got me back into the native terminal stuff. Then I looked back up the guff and saw ‘Selecting previously deselected packunixodbc.’ With the cursor I highlighted the Ok; pressed Enter and – hey – it all installed!

  17. Lawrence says:

    That should read ‘Selecting previously deselected pack@Ok@unixodbc.’ but with greater than less than signs instead of @. Something funny with paste on this page.

  18. Frank Boxall says:

    Hello Lawrence – I’m glad you found a way to install Java. After much flopping around I was able to agree to the license by hitting the tab key, which activated the yes box, and then hitting enter. So now I have Java working.
    The Ubuntu crew should have put Java in the 10.4 distro. By leaving it out, they caused all sorts of misery for dum-dums like us.

  19. Pantelis says:

    2 small issues here:
    – copy + paste will not work:
    sudo add-apt-repository “deb http://archive.canonical.com/ lucid partner”
    Error: need a repository as argument
    Instead this works:
    sudo add-apt-repository “deb http://archive.canonical.com/ lucid partner”
    (seen it, ” ” vs. “ ”)
    If you have already the openjdk installed you must switch to the new sun-jdk:
    sudo update-java-alternatives -l
    gives
    java-6-openjdk 1061 /usr/lib/jvm/java-6-openjdk
    java-6-sun 63 /usr/lib/jvm/java-6-sun
    To use the sun jdk you must:
    sudo update-java-alternatives -s java-6-sun

    Thats all.

  20. Allan says:

    terminal howto

    1. sudo nano /etc/apt/sources.list
    2. uncomment the partner repository. Exit and save.
    3. sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts

    4. firefox http://www.java.com/en/download/help/testvm.xml

  21. Sunny says:

    Thanks Allan & the author of the post,

    1. sudo nano /etc/apt/sources.list
    2. uncomment the partner repository. Exit and save.
    3. You must sudo apt-get update
    4. sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts
    Accept the DLJ License. That’s all . . .
    /Sunny

  22. Quinn N. says:

    Sunofa-
    THANK YOU. I need java to run a Minecraft Server, this is EXACTLY what I needed.

  23. Roger WIlliams says:

    For what it’s worth, I am finding many times when I run some Update from Pkg Manager, the Java settings in /usr/lib/mozilla/plugins gets changed, and that screws up Thunderbird/Lightning and some Firefox settings, particularly for Webex. What seems to work for the 3 critical logical links for my installation so far:

    ln -s /usr/lib/firefox/plugins/flashplugin-alternative.so

    ln -s /usr/lib/jvm/java-6-sun-1.6.0.20/jre/plugin/i386/ns7/libjavaplugin_oji.so
    (This one depends on where you have Sun Java installed)

    ln -s /usr/lib/jvm/java-6-sun-1.6.0.20/jre/lib/i386/libnpjp2.so

    Your mileage may may vary, so look for where these are in your installation, change the links and see what works

  24. kordy says:

    How to install java 5 on Lucid?
    i mean instead of java 6, as i have an application in which facing a problem with java 6 and i have to downgrade.
    and i tried many ways to get java5 and java5 plugin on lucid but no success at all.

  25. mikolayy says:

    thanks for help, I have spend 3 days looking for description like this one

    cheers

  26. Eddy Higgins says:

    It looks like the instructions above contain a typo on the repository line (missing ‘ubuntu’):
    sudo add-apt-repository “deb http://archive.canonical.com/ lucid partner”

    It *should* instead read:
    sudo add-apt-repository “deb http://archive.canonical.com/ubuntu lucid partner”

    Also it’s no harm to put in the deb-src line as well
    sudo add-apt-repository “deb-src http://archive.canonical.com/ubuntu lucid partner”

  27. kev phreak says:

    my terminal just replied that after typin the name below

    sudo apt-get update
    E: Malformed line 54 in source list /etc/apt/sources.list (dist parse)

  28. Roger WIlliams says:

    Kev phreak, likely a typo on line 54 oif that file, and that file is what tells Ubuntu where to look for the updates.

    The safest way (for me, who can’t type worth a damn) is to copy and paste one of the known good lines, then alter it carefully to fit what the new needed repository might be. That way you can also avoid the weirdness of the quotation mark issue.

    Also, note what Eddy Higgins says above your message, the format of the command: , all inside the proper quotes.

    Roger

  29. Mike Bailey says:

    What does: “Uncomment the partner repository. Exit and save.” mean? How do you do that? I keep getting the message: “E: malformed line 54 in source list /etc/apt/sources.list (dist parse) E: The list of sources could not be read.” What do I do?

  30. Roger WIlliams says:

    Mike,panic not. Open a terminal window. Type:
    sudo gedit /etc/apt/sources.list

    The file will open. In that file you will find some lines that are what you would think of as more or less normal, others that start with a # or ##. Those # signs are interpreted by Unix as “don’t read this line”, so *nix ignores whatever follows the # sign on that line.

    E.g.
    This line would be read
    # This line would not be read, so is good for…

    You guessed it: comments in the code. Hence the phrase. To “uncomment” means to remove the # sign. That way Unix or Linux will read the line into whatever is going on.

    You may find something like this in that file:
    # deb http://archive.canonical.com/ubuntu lucid partner

    Take out the # sign and this line now becomes active to the Synaptic Package Manager once you Reload. This Reload within Package Manager will cause the Package Manager to re-read the sources.list file and go get the list of packages available on the now uncommented sites – in this case, the partners.

    If it is not for lucid (10.x) substitute your version (jaunty, etc) in the appropriate place within the command.

    And if you are getting an error on line 54, count down 54 lines from the top of the file, including spaces between paragraphs, and you will find the line with the error. Look at it carefully, compare it with others, look for typos. Believe me, the system knows. If you can’t find the error, you are either not looking well enough, or not looking at the correct line. Been there, done that, felt stupid. Welcome to the club. Only a well-flayed player can call himself a geek, eventually.

    Roger

Leave a Reply

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