For as long as
this link works, its a good generic reference for anyone wanting to update their JRE in Fedora/Linux. The steps below are specific to installing Sun's Java EE SDK (inclusive of JDK and JRE 1.6.0_06) on Fedora Core 6 32-bit i386. Should you be able to succesfully complete the following steps, you shall have the most enviable Java setups around. Here's how you go about it:
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
Thirdly, when performing setup operations, you must always
login as root.
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)
Stage 2: Installing the EE Server- 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
This completes half the story, that is, you built the environment. But still, other applications don't know of its presence, and, in my opinion, you should make it loud and clear! So here's what you do:
Stage 3: Setting up environment variables- Open Applications > Accessories > Text Editor
- Copy paste the following things in a new (blank) file:
export JAVA_HOME=/opt/SDK/jdkexport JRE_HOME=/opt/SDK/jdk/jreexport PATH=$JAVA_HOME/bin:$PATHexport J2RE_HOME=/opt/SDK/jdk/jreexport PATH=$J2RE_HOME/bin:$PATHStage 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 version "1.6.0_03"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 FirefoxNow, 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.soNote that the entire statement above is on a single line, without hitting
anywhere in between.
This will complete the entire installation procedure. I know its long and tedious, but trust me, its well worth the effort.