[CentOS] Installing Java 7 on a system with Java 6

Fri Nov 9 15:14:09 UTC 2012
Keith Roberts <keith at karsites.net>

On Thu, 8 Nov 2012, John J. Boyer wrote:

> To: centos at centos.org
> From: John J. Boyer <john.boyer at abilitiessoft.com>
> Subject: [CentOS] Installing Java 7 on a system with Java 6
> 
> My system is 5.6, with upgrades. I installed Java 6 from the Centos
> repository. It doesn't seem to have Java 7. I need the development
> package. How can I install Java 7 development safely? I imagine I will
> first have to uninstall Java 6.

Hi John.

I'm running C5.8 and I don't use iced tea or any java 
from the repos.

I have recently installed the Oracle
Java SE Development Kit (JDK) direct from:

http://www.oracle.com/technetwork/java/javase/downloads/index.html

I use the rpm.bin version, as it unpacks and install 
quick, and sets up the symlinks under /usr/java.

Here's the output from installing it:

[root at karsites 6u37]# ./jdk-6u37-linux-i586-rpm.bin
Unpacking...
Checksumming...
Extracting...
UnZipSFX 5.50 of 17 February 2002, by Info-ZIP 
(Zip-Bugs at lists.wku.edu).
   inflating: jdk-6u37-linux-i586.rpm
   inflating: sun-javadb-common-10.6.2-1.1.i386.rpm
   inflating: sun-javadb-core-10.6.2-1.1.i386.rpm
   inflating: sun-javadb-client-10.6.2-1.1.i386.rpm
   inflating: sun-javadb-demo-10.6.2-1.1.i386.rpm
   inflating: sun-javadb-docs-10.6.2-1.1.i386.rpm
   inflating: sun-javadb-javadoc-10.6.2-1.1.i386.rpm
Preparing...
########################################### [100%]
1:jdk
########################################### [100%]
Unpacking JAR files...
         rt.jar...
         jsse.jar...
         charsets.jar...
         tools.jar...
         localedata.jar...
         plugin.jar...
         javaws.jar...
         deploy.jar...
...

Java(TM) SE Development Kit 6 successfully installed.

Product Registration is FREE and includes many benefits:
* Notification of new versions, patches, and updates
* Special offers on Oracle products, services and training
* Access to early releases and documentation

The rpm.bin version installs java under 
/usr/java/jdk1.6.0_37

After the installation I copy /usr/java/jdk1.6.0_37
to /usr/local/java/jdk1.6.0_37

and delete or rename the /usr/java/jdk1.6.0_37
then create the symlinks to the copy at
/usr/local/java/jdk1.6.0_37

[root at karsites java]# tree -A
.
├── default -> /usr/java/latest
├── jdk1.6.0_37 -> /usr/local/java/jdk1.6.0_37
└── latest -> /usr/java/jdk1.6.0_37

I have had issues with java before such as printing from 
Java applications not working. By installing Java this way, 
I can keep different older versions of java on 
/usr/local/java and as /usr/local is a mounted partition, 
the java installation survives a reinstallation of the OS, 
without me having to reinstall java again.

Also some Java applications did not work correctly when 
using the open source version of java, as opposed to the 
Sun - now Oracle version.

[root at karsites CLI]# java -version
java version "1.6.0_37"
Java(TM) SE Runtime Environment (build 1.6.0_37-b06)
Java HotSpot(TM) Client VM (build 20.12-b01, mixed mode, 
sharing)

HTH

Keith Roberts

-----------------------------------------------------------
Websites:
http://www.karsites.net
http://www.php-debuggers.net
http://www.raised-from-the-dead.org.uk

All email addresses are challenge-response protected with
TMDA [http://tmda.net]
-----------------------------------------------------------