Downloaded a jdk1.7 bin installation
However, after installing and setting up the environment, running Java to see the version number found an error:
$ java -version
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object
Check the path and classpath are set up no problem, look at the installation, actually found that the Lib directory is not Tools.jar and jre/lib under no Rt.jar:
$ ls -al /usr/java/jdk1.7/lib
total 8148
-rw-r--r-- 1 root root 139034 Oct 31 15:08 dt.jar
-rw-r--r-- 1 root root 1161394 Oct 31 15:08 htmlconverter.jar
-rw-r--r-- 1 root root 18381 Oct 31 15:08 ir.idl
-rw-r--r-- 1 root root 429 Oct 31 15:08 orb.idl
-rw-r--r-- 1 root root 1743428 Oct 31 15:08 tools.pack
-rwxr-xr-x 1 root root 145112 Oct 31 15:08 unpack
Instead, Tools.pack and Rt.pack.
Then use the Uppack tool in the Lib directory to extract the two jars:
$ cd /usr/java/jdk1.7/lib
$ unpack tools.pack tools.jar
$ cd ../jre/lib
$ ../../unpack rt.pack rt.jar
在查看:
$ ls -l /usr/java/jdk1.7/lib/tools.*
-rw-r--r-- 1 root root 5092901 Oct 31 15:29 /usr/java/jdk1.7/lib/tools.jar
-rw-r--r-- 1 root root 1743428 Oct 31 15:08 /usr/java/jdk1.7/lib/tools.pack
$ ls -l /usr/java/jdk1.7/jre/lib/rt.*
-rw-r--r-- 1 root root 26782544 Oct 31 15:32 /usr/java/jdk1.7/jre/lib/rt.jar
-rw-r--r-- 1 root root 8684102 Oct 31 15:08 /usr/java/jdk1.7/jre/lib/rt.pack
In running Java everything is fine:
Java-version
Java Version "1.7"
Installation of the JDK bin package