[java] How to install java on linux

Started by
12 comments, last by jolyqr 17 years, 6 months ago
Basically, I recently removed WXP from my laptop and installed Linux Xubuntu on it. I would like to run my former Java projects.I have some difficulties for installing Java. I have followed instructions of the following web page : http://java.sun.com/j2se/1.4.2/install-linux.html but I've got some issues... I have choosen the RPM installation. when I have typed the following commands on the shell : http://java.sun.com/j2se/1.4.2/install-linux.html ./jre-1_5_0_06-linux-i586-rpm.bin I've got the following errors : inflating: jre-1_5_0_06-linux-i586.rpm error: Failed dependencies: glibc >= 2.1.2-11 is needed by jre-1.5.0_06-fcs.i586 sh-utils >= 2.0-1 is needed by jre-1.5.0_06-fcs.i586 fileutils >= 4.0-8 is needed by jre-1.5.0_06-fcs.i586 gawk >= 3.0.4-1 is needed by jre-1.5.0_06-fcs.i586 textutils >= 2.0-2 is needed by jre-1.5.0_06-fcs.i586 /bin/sh is needed by jre-1.5.0_06-fcs.i586 If someone has got an idea then let me know cheers
Advertisement
Most Linux distributions come with Java installed. To test this, enter the command "which java". This will tell you if (and where) you already have it installed.

If you know it's not installed, or are updating version, sorry, please ignore me [smile].
you're maybe right. it seems to be already installed. i think the problem comes from how configuring mozilla firefox with it...
Do not install Java via .rpm in Ubuntu; Rather, download the .bin (self extract file), and run it with "sudo sh (file).bin" on the directory where you want to install the JDK.

Also, you'll want to create a symbolic link to the new JDK:

cd /usr/bin
unlink java
ln -s /opt/jdk1.6/bin/java java

The command above will create a link to the "java" app in the JDK 1.6 folder, if installed on /opt

To have packages such as build essential packages, you need to enable extra and/or restricted repositories on apt, and use "sudo apt-get install" command. For example, "sudo apt-get install build-essentials" will install several compilers and other essential tools for building and compiling applications on Ubuntu.

Let me know if you have more problems.

[Edit: For more information, access http://ubuntuguide.org/wiki/Dapper ]
a.k.a javabeats at yahoo.ca
Quote:Original post by Son of Cain
Do not install Java via .rpm in Ubuntu; Rather, download the .bin (self extract file), and run it with "sudo sh (file).bin" on the directory where you want to install the JDK.

Also, you'll want to create a symbolic link to the new JDK:

cd /usr/bin
unlink java
ln -s /opt/jdk1.6/bin/java java

The command above will create a link to the "java" app in the JDK 1.6 folder, if installed on /opt

To have packages such as build essential packages, you need to enable extra and/or restricted repositories on apt, and use "sudo apt-get install" command. For example, "sudo apt-get install build-essentials" will install several compilers and other essential tools for building and compiling applications on Ubuntu.

Let me know if you have more problems.

[Edit: For more information, access http://ubuntuguide.org/wiki/Dapper ]


I've didn't really get how work the symbolic link.
It seems that Java and Mozilla are installed in the same folder: usr/bin
How should I write commands that set the symbolic link?

In order to integrate Mozilla and Java, look at the guide I suggested on my previous post, here.

To create symbolic links, you use the "ln" command. Type "ln man" on your terminal window, and the manual for this command will appear for you. Do you have any previous experience with Linux? If not, I really suggest you to go through that guide before doing anything else.
a.k.a javabeats at yahoo.ca
Quote:Original post by Son of Cain
In order to integrate Mozilla and Java, look at the guide I suggested on my previous post, here.

To create symbolic links, you use the "ln" command. Type "ln man" on your terminal window, and the manual for this command will appear for you. Do you have any previous experience with Linux? If not, I really suggest you to go through that guide before doing anything else.


I know this website, I have used it to install some application. Nonetheless, the following commands don't work :

sudo apt-get install sun-java5-jre sun-java5-plugin


basically when I type them I've got the following error :


Reading package lists... Done
Building dependency tree... Done
E: Couldn't find package sun-java5-jre
That's because you haven't enabled the extra repositories. Check the link on the same website. A repository is a place where the package manager will look for files, and the standard repositories that come with the distribution do not contain such packages.
a.k.a javabeats at yahoo.ca
Quote:Original post by Son of Cain
That's because you haven't enabled the extra repositories. Check the link on the same website. A repository is a place where the package manager will look for files, and the standard repositories that come with the distribution do not contain such packages.


Even enabling extra repositories doesn't work. Basically I have chosen to do it by using the terminal, but I've got the following errors :

Ign http://packages.freecontrib.org dapper Release.gpg
Get:1 http://packages.freecontrib.org dapper Release [9421B]
Get:2 http://packages.freecontrib.org dapper/free Packages [1974B]
Get:3 http://packages.freecontrib.org dapper/non-free Packages [2576B]
Get:4 http://packages.freecontrib.org dapper/free Sources [808B]
Get:5 http://packages.freecontrib.org dapper/non-free Sources [1081B]
Get:6 http://archive.canonical.com dapper-commercial Release.gpg [191B]
Get:7 http://archive.canonical.com dapper-commercial Release [4886B]
Get:8 http://archive.canonical.com dapper-commercial/main Packages [1906B]
Get:9 http://security.ubuntu.com dapper-security Release.gpg [191B]
Get:10 http://archive.ubuntu.com dapper Release.gpg [189B]
Get:11 http://archive.ubuntu.com dapper-updates Release.gpg [191B]
Get:12 http://security.ubuntu.com dapper-security Release [30.9kB]
Get:13 http://archive.ubuntu.com dapper-backports Release.gpg [191B]
Get:14 http://archive.ubuntu.com dapper Release [34.8kB]
Get:15 http://archive.ubuntu.com dapper-updates Release [29.6kB]
Get:16 http://security.ubuntu.com dapper-security/main Packages [74.1kB]
Get:17 http://archive.ubuntu.com dapper-backports Release [23.3kB]
Get:18 http://archive.ubuntu.com dapper/main Packages [619kB]
Get:19 http://security.ubuntu.com dapper-security/restricted Packages [6446B]
Get:20 http://security.ubuntu.com dapper-security/universe Packages [29.8kB]
Get:21 http://security.ubuntu.com dapper-security/multiverse Packages [2789B]
Get:22 http://security.ubuntu.com dapper-security/main Sources [13.3kB]
Get:23 http://security.ubuntu.com dapper-security/restricted Sources [960B]
Get:24 http://security.ubuntu.com dapper-security/universe Sources [3874B]
Get:25 http://security.ubuntu.com dapper-security/multiverse Sources [520B]
Get:26 http://archive.ubuntu.com dapper/restricted Packages [4571B]
Get:27 http://archive.ubuntu.com dapper/universe Packages [2458kB]
Get:28 http://archive.ubuntu.com dapper/multiverse Packages [95.2kB]
Get:29 http://archive.ubuntu.com dapper/main Sources [255kB]
Get:30 http://archive.ubuntu.com dapper/restricted Sources [1478B]
Get:31 http://archive.ubuntu.com dapper/universe Sources [975kB]
Get:32 http://archive.ubuntu.com dapper/multiverse Sources [46.6kB]
Get:33 http://archive.ubuntu.com dapper-updates/main Packages [122kB]
Get:34 http://archive.ubuntu.com dapper-updates/restricted Packages [14B]
Get:35 http://archive.ubuntu.com dapper-updates/universe Packages [19.3kB]
Get:36 http://archive.ubuntu.com dapper-updates/multiverse Packages [964B]
Get:37 http://archive.ubuntu.com dapper-updates/main Sources [46.5kB]
Get:38 http://archive.ubuntu.com dapper-updates/restricted Sources [14B]
Get:39 http://archive.ubuntu.com dapper-updates/universe Sources [3129B]
Get:40 http://archive.ubuntu.com dapper-updates/multiverse Sources [427B]
Get:41 http://archive.ubuntu.com dapper-backports/main Packages [9250B]
Get:42 http://archive.ubuntu.com dapper-backports/restricted Packages [14B]
Get:43 http://archive.ubuntu.com dapper-backports/universe Packages [25.6kB]
Get:44 http://archive.ubuntu.com dapper-backports/multiverse Packages [1804B]
Get:45 http://archive.ubuntu.com dapper-backports/main Sources [3668B]
Get:46 http://archive.ubuntu.com dapper-backports/restricted Sources [14B]
Get:47 http://archive.ubuntu.com dapper-backports/universe Sources [6564B]
Get:48 http://archive.ubuntu.com dapper-backports/multiverse Sources [864B]
Fetched 4969kB in 1m5s (76.1kB/s)
E: Could not get lock /var/lib/dpkg/lock - open (11 Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

I'm quite desperate...


You need to make sure that no0 other package management software is running (make sure that Synaptic or something isn't open, for example) and you need to MAKE SURE YOU'RE ROOT.

Also, if you haven't done it, make sure you have the right package name... do an "apt-cache search java" and see what's in the repository.

This topic is closed to new replies.

Advertisement