Current maintainer of HowTos/Laptops/Wireless/Broadcom page
Email: <milos.blazevic AT sbb DOT rs> or <milos.blazevic AT gmail DOT com>
- Website: N/A
- Blog: N/A
What are your personal interests in the CentOS project ?
List of achievements
What have you accomplished already ?
Personal TODO list
What items are you going to do (if time permits) ?
- IN PROGRESS: N/A
Sun (Oracle) Java installation manual - DRAFT
Installing Sun Java on CentOS 5
This manual is intended to help readers install Oracle (formerly known as Sun) Java on CentOS 5 system.
NOTE: Most readers won't be needing full-blown Java Development Kit (aka. Sun JDK) we're using here for demonstration and installation in the manual. If you're one of them, feel free to download Java Runtime Environment (aka. Sun JRE), and apply the same steps as with JDK. In this manual Java version 6u23 is being installed and configured.
- Miloš Blažević
- Installing Sun Java on CentOS 5
In order to install Sun Java JRE/JDK, the next steps should be followed:
Step 1: Downloading Oracle Java Linux RPM package from Oracle's website and extracting the downloaded package
Download either JRE, or JDK (whichever you need or prefer) from Java SE Downloads website, make the appropriate selection (choosing between 32 and 64-bit, etc.) and save the package to your home folder for example ~/).
NOTE: After you select between 32 and 64-bit packages, you'll be given a choice of 2 packages to download. Make sure you download the one having the filename ending in -rpm.bin, as in jdk-6u23-linux-x64-rpm.bin.
Change the permissions on the package so you could extract it to an arbitrary folder, say ~/sun-jdk/:
[user@localhost ~]$ chmod 744 jdk-6u23-linux-x64-rpm.bin [user@localhost ~]$ mkdir ~/sun-jdk ; cd sun-jdk [user@localhost sun-jdk]$ sh -x ../jdk-6u23-linux-x64-rpm.bin
As a result, you'll have the following .rpm packages in the ~/sun-jdk folder:
[user@localhost sun-jdk]$ ls -lh total 78M -rw-r--r-- 1 milos milos 68M Nov 13 01:40 jdk-6u23-linux-amd64.rpm -rw-r--r-- 1 milos milos 483K Nov 12 2009 sun-javadb-client-10.5.3-0.2.i386.rpm -rw-r--r-- 1 milos milos 16K Nov 12 2009 sun-javadb-common-10.5.3-0.2.i386.rpm -rw-r--r-- 1 milos milos 3.8M Nov 12 2009 sun-javadb-core-10.5.3-0.2.i386.rpm -rw-r--r-- 1 milos milos 935K Nov 12 2009 sun-javadb-demo-10.5.3-0.2.i386.rpm -rw-r--r-- 1 milos milos 4.5M Nov 12 2009 sun-javadb-docs-10.5.3-0.2.i386.rpm -rw-r--r-- 1 milos milos 181K Nov 12 2009 sun-javadb-javadoc-10.5.3-0.2.i386.rpm
NOTE: In case you opt installing Oracle JRE, instead of JDK, the result of package content extraction will be a single file (i.e. jre-6u23-linux-amd64.rpm). However, great majority of people who opt installing JDK will be needing only one of the extracted files, and that is jdk-6u23-linux-amd64.rpm
Step 2: Installing Sun Java
From here, you can install the extracted .rpm binary, but only after assuming root privileges:
[root@host sun-jdk]# rpm -ivvh jdk-6u23-linux-amd64.rpm
The installation of an .rpm should be seamless, but just in case to be sure, run the following command immediately after the .rpm installation finishes:
[root@host sun-jdk]# echo $?
if the output of a command is 0, everything went just fine and you can move on to the next step.
Step 3: Configuring Sun Java as the default Java
Once you've installed Sun Java, check which is the default Java binary currently used on your system:
[user@host ~]$ java -version java version "1.6.0_17" OpenJDK Runtime Environment (IcedTea6 1.7.5) (rhel-1.16.b17.el5-x86_64) OpenJDK 64-Bit Server VM (build 14.0-b16, mixed mode)
As you can see, the default Java is the OpenJDK, which needs to be 'replaced' with Sun Java.
Of course, if the above command yields something else, like:
[user@host ~]$ java -version java version "1.6.0_23" Java(TM) SE Runtime Environment (build 1.6.0_23-b05) Java HotSpot(TM) 64-Bit Server VM (build 19.0-b09, mixed mode)
this means the following steps are redundant, and the Java you just installed is the ONLY Java currently present on your system, and hence the default Java. ||
In order to configure the new Sun Java binary as a default, we'll use the alternatives utility: ==
[root@host ~]# alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_23/bin/java 1
Now, new binary alternative has been added for future use and now needs to be configured:
[root@host ~]# alternatives --config java
and in return you'll get the following interactive menu, in which you're expected to configure the newly installed Java as the default one:
There are 3 programs which provide 'java'. Selection Command ----------------------------------------------- *+ 1 /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java 2 /usr/lib/jvm/jre-1.4.2-gcj/bin/java 3 /usr/java/jdk1.6.0_23/bin/java Enter to keep the current selection[+], or type selection number:
Clearly, what you need is the option number 3. And voilla! Your newly installed Java binary will be invoked by default every time you or some other app needs JVM. But, just to make sure our job is done, check the default Java binary again. Of course, this time, you'll find the output somewhat different
[user@host ~]# java -version java version "1.6.0_23" Java(TM) SE Runtime Environment (build 1.6.0_23-b05) Java HotSpot(TM) 64-Bit Server VM (build 19.0-b09, mixed mode)
That pretty much does it for now. You're good to go.
If you are planning to do presentations, it could be interesting to provide a short and long biography upfront so Event organizers can simply provide this information when they need it.
Firstname Lastname does a lot of things, but mostly is very good in one-line biography writing.
Since Firstname Lastname was born, he grew up being attached to Linux...