Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am new at Ubuntu 12.04 LTS. I need to install Java 6 or 7. But, when I want to do it using the software center or by terminal it responds me "install failed" and "check your Internet connection". But, I can easily install other software using Software Center and Terminal and there is no problem in my Internet connection.

What should I do now? How can I install Java on Ubuntu?

share|improve this question
    
do you have any custom sources added for the java packages? PPAs? –  Karthik T Nov 28 '12 at 5:12
    
by install from terminal you mean sudo apt-get update and sudo apt-get install <name of package> right? –  Karthik T Nov 28 '12 at 5:13
    
and have you tried synaptic package manager instead of software center? –  Karthik T Nov 28 '12 at 5:14
    
no i haven't use synaptic package manager. I have tried sudo apt-get update and sudo apt-get install <name of package>. but still unsuccessful. –  Himangshu Barmon Nov 28 '12 at 5:29
add comment

1 Answer 1

If you need more information about installing java here is the documentation

I supposed that you mean the Oracle (Sun) Java 6

Do the following if you are planning to install the jre

$ wget http://download.oracle.com/otn-pub/java/jdk/6u34-b04/jre-6u34-linux-i586.bin
 $ chmod u+x jre-6u34-linux-i586.bin
 $ ./jre-6u34-linux-i586.bin
 $ sudo mkdir -p /usr/lib/jvm
 $ sudo mv jre1.6.0_34 /usr/lib/jvm/
 $ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jre1.6.0_34/bin/java" 1
 $ sudo update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin.so" "/usr/lib/jvm/jre1.6.0_34/lib/i386/libnpjp2.so" 1
 $ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jre1.6.0_34/bin/javaws" 1

If you are planning to install the oracle java 6 jdk 32-bit

$ wget http://download.oracle.com/otn-pub/java/jdk/6u34-b04/jdk-6u34-linux-i586.bin
 $ chmod u+x jdk-6u34-linux-i586.bin
 $ ./jdk-6u34-linux-i586.bin
 $ sudo mkdir -p /usr/lib/jvm
 $ sudo mv jdk1.6.0_34 /usr/lib/jvm/
 $ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.6.0_34/bin/java" 1
 $ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.6.0_34/bin/javac" 1
 $ sudo update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin.so" "/usr/lib/jvm/jdk1.6.0_34/jre/lib/i386/libnpjp2.so" 1
 $ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jre1.6.0_34/bin/javaws" 1

And this important

 $ sudo update-alternatives --config java
 $ sudo update-alternatives --config javac
 $ sudo update-alternatives --config mozilla-javaplugin.so
 $ sudo update-alternatives --config javaws
share|improve this answer
    
-------------$ chmod u+x jdk-6u34-linux-i586.bin--------- this line is showing no directory error. –  Himangshu Barmon Nov 28 '12 at 5:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.