QA@IT

How to install Java on Ubuntu 12.04?

2920 PV

When I install any package,it always shows me

...
Proxy tunneling failed: Bad RequestUnable to establish SSL connection.
download failed
Oracle JDK 7 is NOT installed.
dpkg: error processing oracle-java7-installer (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 oracle-java6-installer
 oracle-java7-installer
E: Sub-process /usr/bin/dpkg returned an error code (1)

But I don't know how to install Java..

  • If you are comfortable with English, I recommend that you go to StackOverflow.com This site doesn't explicitly state about the language you use, but it's not nice to use English when others don't. -
  • ok -

回答

There are a few different ways to install jdk to ubuntu.

install openjdk

If you don't need oracle version jdk, you can install openjdk with command below:

$ sudo apt-get install openjdk-6-jdk

or

$ sudo apt-get install openjdk-7-jdk

note: If you want install only JRE,
substitute package name with jre package name (openjdk-6-jre , openjdk-7-jre or etc).

install oracle jdk via PPA

You can install oracle jdk via PPA. PPA (Personal Package Archive) is repository.
http://en.wikipedia.org/wiki/Personal_Package_Archive

If it's OK to install java via PPA, do following commands:

$ sudo add-apt-repository ppa:webupd8team/java

$ sudo apt-get update

$ sudo apt-get install oracle-jdk7-installer

note: If you want install only JRE,
substitute package name with jre package name (oracle-java6-installer , oracle-java7-installer or etc).

Of course, you can download installer from oracle and install that. But install via PPA is more easy.
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

編集 履歴 (0)
ウォッチ

この質問への回答やコメントをメールでお知らせします。