Install new JDK or JRE
From MEPIS Documentation Wiki
!!! Warning! The info contained in this article pertains to older versions of MEPIS !!!
See Java How-tos for newer info.
Step 1 - Get the SunJVM
You can get the latest Sun JVM from here http://java.sun.com/
[Note: As a (much easier) alternative, for MEPIS-8.0, the Sun java packages are now in the repositories, so you can now install them using Synaptic. Look for package names 'sun-java6-jre', 'sun-java5-jre', etc. After installing via Synaptic, proceed directly to Step 6.]
Step 2 - Install the Required Builder Package
apt-get -u install java-package This package allows you to take the bin file that sun provides and make a .deb out of it.
Make sure that your repository is fully up to date before installing this package or you might run into problems installing the latest JVM. You also need fakeroot if you don't have it.
Step 3 - Create the .deb Package File
You have to perform this step as a non-root user so I suggest using your own account. Create a temporary directory and copy the java .bin installer file into it. then run the command:
fakeroot make-jpkg jdk-1_5_0-linux-i586.bin
changing the name of the java .bin package if you need to. You may see a few warnings while the package is being created (and it takes some time to actually create it - about 2 minutes). If you see a message at the end saying the package was created then the warnings are not a problem. The message will probably look something like this:
The Debian package has been created in the current directory. You can install the package as root (e.g. dpkg -i sun-j2sdk1.5_1.5.0+update00_i386.deb).
Step 4 - Install the Java .deb Package
You need to be root to perform this step so switch now. Then execute the following command:
dpkg -i sun-j2sdk1.5_1.5.0+update00_i386.deb
Of course you need to specify the correct package name if yours doesn't match mine. You can find out what the package name is from looking at the success message.
Step 5 - Check it Works
as both root and another user to make sure everything is installed correctly. You should see output not a million miles different to that shown below.
java version "1.5.0" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64) Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)
Step 6 -- run update-alternatives --config to change java default globally
update-alternatives --config java
There are various alternatives which provide `java'. The 2 shown below are just EXAMPLES of some choices.
* 1 /usr/lib/j2sdk1.5-sun/bin/java
+ 2 /usr/lib/j2se/1.4/bin/java
Press enter to keep the default[*], or type selection number: 1 Using `/usr/lib/j2sdk1.5-sun/bin/java' to provide `java'.
That is it. This gives you a way to keep everything manageable through apt and a way to change GLOBALLY between java versions and/or vendors. You can switch among the alternatives as you see fit, without needing to un-install or re-install the various java packages.