How do I get ORACLE JAVA SE 7 to work?
Download the Oracle java from its offical website
Download Java From Official website Here
Manually Install the JDK 1.7
#java -version
#sudo mkdir -p /usr/lib/jvm
#sudo mv jdk-7u21-linux-i586.tar.gz /usr/lib/jvm
#cd /usr/lib/jvm
#sudo tar zxvf jdk-7u21-linux-i586.tar.gz
#sudo rm jdk-7u21-linux-i586.tar.gz
#ls -l
#jdk1.7.0_21
#sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0_21/bin/javac" 1
#sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0_21/bin/java" 1
#sudo update-alternatives --set "javac" "/usr/lib/jvm/jdk1.7.0_21/bin/javac"
#sudo update-alternatives --set "java" "/usr/lib/jvm/jdk1.7.0_21/bin/java"
#sudo vi /etc/profile
Add the following entries to the bottom of your /etc/profile file:
#JAVA_HOME=/usr/lib/jvm/jdk1.7.0_21 PATH=$PATH:$JAVA_HOME/bin export JAVA_HOME export PATH
#. /etc/profile
#java -version
Replace the jdk1.7.0_21 With the version u have Downloaded
Related videos on Youtube
SirBT
Updated on September 18, 2022Comments
-
SirBT over 1 year
I am a newbie to Ubuntu, so kindly be considerate.
I recently manually downloaded & installed (Java SE 7ux) JavaSE 1.7.0_51. Linux x64 (for 64-bit system) "tar.gz" package. My Ubuntu version is 13.10 (OS 64 bit)
I carefully following the instructions from: How to Install JDK 7 on Ubuntu
To verify that the installation was successful I wrote:
javac -version
and get the below results:
Error occurred during initialization of VM java/lang/NoClassDefFoundError: java/lang/Object $ which java gives the below results: /usr/bin/java $ which javac also gives the below results: /usr/bin/javac
I repeated the steps a couple of times just in case I missed out an important step but still got the same results. After a couple of researching on-line I found out @ Reference, that I could actually install Java on Ubuntu via PPA repository.
After the installation when I
$ java -version
I still get:
Error occurred during initialization of VM java/lang/NoClassDefFoundError: java/lang/Object
However when I
$ cd /usr/bin $ ls -ld java*
I get:
lrwxrwxrwx 1 root root 22 Feb 19 19:06 java -> /etc/alternatives/java lrwxrwxrwx 1 root root 23 Feb 17 02:15 javac -> /etc/alternatives/javac lrwxrwxrwx 1 root root 25 Feb 19 20:09 javadoc -> /etc/alternatives/javadoc lrwxrwxrwx 1 root root 32 Feb 19 20:09 javafxpackager -> /etc/alternatives/javafxpackager lrwxrwxrwx 1 root root 23 Feb 19 20:09 javah -> /etc/alternatives/javah lrwxrwxrwx 1 root root 23 Feb 19 20:09 javap -> /etc/alternatives/javap lrwxrwxrwx 1 root root 25 Feb 19 20:09 java_vm -> /etc/alternatives/java_vm lrwxrwxrwx 1 root root 24 Feb 17 02:15 javaws -> /etc/alternatives/javaws
Also similar to:
$ cd /etc/alternatives $ ls -ld java* lrwxrwxrwx 1 root root 36 Feb 19 19:15 java -> /usr/local/java/jdk1.7.0_51/bin/java lrwxrwxrwx 1 root root 37 Feb 17 02:15 javac -> /usr/local/java/jdk1.7.0_51/bin/javac lrwxrwxrwx 1 root root 38 Feb 19 20:09 javadoc -> /usr/lib/jvm/java-7-oracle/bin/javadoc lrwxrwxrwx 1 root root 48 Feb 19 20:09 javadoc.1.gz -> /usr/lib/jvm/java-7-oracle/man/man1/javadoc.1.gz lrwxrwxrwx 1 root root 45 Feb 19 20:09 javafxpackager -> /usr/lib/jvm/java-7-oracle/bin/javafxpackager lrwxrwxrwx 1 root root 55 Feb 19 20:09 javafxpackager.1.gz -> /usr/lib/jvm/java-7-oracle/man/man1/javafxpackager.1.gz lrwxrwxrwx 1 root root 36 Feb 19 20:09 javah -> /usr/lib/jvm/java-7-oracle/bin/javah lrwxrwxrwx 1 root root 46 Feb 19 20:09 javah.1.gz -> /usr/lib/jvm/java-7-oracle/man/man1/javah.1.gz lrwxrwxrwx 1 root root 36 Feb 19 20:09 javap -> /usr/lib/jvm/java-7-oracle/bin/javap lrwxrwxrwx 1 root root 46 Feb 19 20:09 javap.1.gz -> /usr/lib/jvm/java-7-oracle/man/man1/javap.1.gz lrwxrwxrwx 1 root root 42 Feb 19 20:09 java_vm -> /usr/lib/jvm/java-7-oracle/jre/bin/java_vm lrwxrwxrwx 1 root root 42 Feb 17 02:15 javaws -> /usr/local/java/jdk1.7.0_51/jre/bin/javaws
Note that
javadoc.1.gz -> /usr/lib/jvm/java-7-oracle/man/man1/javadoc.1.gz javafxpackager.1.gz -> /usr/lib/jvm/java-7-oracle/man/man1/javafxpackager.1.gz javah.1.gz -> /usr/lib/jvm/java-7-oracle/man/man1/javah.1.gz javah.1.gz -> /usr/lib/jvm/java-7-oracle/man/man1/javah.1.gz
...are all in RED
- What does all this mean and most importantly how do I make my Java installation work?
Looking forward to you help!
-
Babin Lonston about 10 yearsRemove it Using # sudo apt-get remove java*
-
SirBT about 10 yearssudo apt-get remove java* messed up my system. Alot of applications ubuntu disappeared, so I am working on reinstalling alot of them back. But Thanks the solution worked!
-
Babin Lonston about 10 yearsIf Some other Program messed up after installing above, Just do # suso apt-get install java*
-
Navdeep Singh almost 9 yearsCould you please share the steps to reverse it all you mentioned above