Before we begin, there are a few things you need to know. Whenever I mention something like:
$cd /opt
..it means that the command cd /opt must be typed at the prompt (so called as the dollar prompt) in the Terminal (that is Applications > Accessories > Terminal). Don't worry, you won't see a dollar sign in the terminal, but its just a convention of writing. Note that you must not type the dollar sign while entering the command.
Secondly, there is no such thing as a registry, in Linux. So you don't have to 'install' applications using an installer. You will generally get a .tar.gz or a .zip file from the download sites. These files must be simply extracted, and the resulting folder must be copied to any location of your choice. However, by convention, such folders are copied into /usr/lib/ directory under your file system. (The file system can be accessed from Applications > System Tools > File Browser). However, since there is no installation, some manual configuring effort is required. This effort is largely context dependent, and will vary as per:
- Distribution of Linux (Fedora, RedHat, Ubuntu, Debian, Mandriva, Gentoo.....)
- Version of distribution (Fedora 8, RedHat 10.....)
- The hardware platform for the distribution (i386 in my case, for Intel 32-bit processors)
- Application version you've downloaded
- Where you've saved (or subsequently copied) the extracted folder
Now, with a basic understanding of these things, lets get to the real thing:
Stage 1: Downloading the correct file, to the correct place
- Go to http://java.sun.com
- Select Downloads > Java EE
- Click on Download with JDK
- Accept the License Agreement
- Click on the link to Java EE SDK 5 Update 3 under Linux platform
- If you are using Firefox with default settings, the java_ee_sdk-5_03-linux.bin file will get downloaded to your Desktop
- Once done, copy the bin file to /opt (under your File System)
- Open Applications > Accessories > Terminal
- $cd /opt
- $chmod +x java_ee_sdk-5_03-linux.bin
- $./java_ee_sdk-5_03-linux.bin
- Now, Java's GUI installation will begin.
- Proceed through the installation normally
- At the end, click on Start Server. If the installation proceeded succesfully, you should see a "Your server is up and running" page when you type http://localhost:8080/ in your browser
- Also, a SDK directory will be created under /opt
Stage 3: Setting up environment variables
- Open Applications > Accessories > Text Editor
- Copy paste the following things in a new (blank) file:
export JRE_HOME=/opt/SDK/jdk/jre
export PATH=$JAVA_HOME/bin:$PATH
export J2RE_HOME=/opt/SDK/jdk/jre
export PATH=$J2RE_HOME/bin:$PATH
Stage 4: Configuring the environment for use throughout Fedora
- Now save the file as java.sh in /etc/profile.d under your File System
- Back, to the terminal, do the following things:
- $source /etc/profile.d/java.sh
- $which java
- If you have proceeded correctly upto this stage, you should see /opt/SDK/jdk/jre/bin/java as the result.
- Proceed ahead ONLY IF you get this result. Else, you've gone wrong and must retrace. There's no point in moving forward if you don't get this result.
- Now, continue typing in terminal with the following commands:
- $usr/sbin/alternatives --install /usr/bin/java java /opt/SDK/jdk/jre/bin/java 2
- $usr/sbin/alternatives --config java
- Type 2 and hit enter
- $java -version
- If installation is complete, it should give the following result:
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode)
Stage 5: Installing the JRE plugin for Firefox
Now, the final stage remains that of hooking up the JRE with your browser. Assuming you have correctly installed Mozilla Firefox 2.0.0.9 in /usr/lib/firefox do the following:
$ln -s /opt/SDK/jdk/jre/plugin/i386/ns7/libjavaplugin_oji.so /usr/lib/firefox/plugins/libjavaplugin_oji.so
Note that the entire statement above is on a single line, without hitting
This will complete the entire installation procedure. I know its long and tedious, but trust me, its well worth the effort.
5 comments:
Hi :)
This is a brilliant guide! Thankyou, I have been bashing my head trying to figure this out :)
I am installign on debian, so there was a little bit of 'thinking' involved, but no too much. Everything seemed to work up until the last part:
root@EITdebian:/# /usr/sbin/update-alternatives --install /usr/bin/java java /opt/SDK/jdk/jre/bin/java 2
root@EITdebian:/# /usr/sbin/update-alternatives --config java
There are 3 alternatives which provide `java'.
Selection Alternative
-----------------------------------------------
1 /usr/bin/gij-wrapper-4.1
*+ 2 /usr/lib/jvm/java-6-sun/jre/bin/java
3 /opt/SDK/jdk/jre/bin/java
Press enter to keep the default[*], or type selection number: 2
Using `/usr/lib/jvm/java-6-sun/jre/bin/java' to provide `java'.
root@EITdebian:/# java --version Unrecognized option: --version
Could not create the Java virtual machine.
====================
I can not find any mention of this elsewhere. Are you aware of any possibilities here?
Thankyou again :)
Please reply to ghostsblood@gmail.com :)
please ignore my previous post. I needed only one hyphen on the version flag.
Regards
Hi
I just finished installing java in my Centos5 server. You made such a great guide and very easy to follow.
Thanks a lot.
---
ma
excellent guide.
on ubuntu, you would use 'update-alternatives'.
the browser plugin however needs tweaking.
On Ubuntu, when starting the GUI installation, if you get a blank screen, disable compiz.
My 2¢
Post a Comment