Ubuntu – Troubleshoot sun-java6-jdk installation

10.1064-bitjavajdk

  1. Just finished a clean install of Ubuntu 10.10 on a new machine
  2. I added the partner repository via ubuntu software center
  3. I ran 'sudo apt-get install sun-java6-jdk'
  4. I ran 'sudo update-java-alternatives -s java-6-sun' and got this error:
alex@alex-home:~$ sudo update-java-alternatives -s java-6-sun 
update-alternatives: error: no alternatives for mozilla-javaplugin.so. 
update-alternatives: error: no alternatives for xulrunner-1.9-javaplugin.so. 
update-alternatives: error: no alternatives for mozilla-javaplugin.so. 
update-alternatives: error: no alternatives for xulrunner-1.9-javaplugin.so.

Double checking it failed, I am still on the JRE:

alex@alex-home:~$ java -version
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03, mixed mode)
alex@alex-home:~$ 

Tried this too:

alex@alex-home:~$ sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                      Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-6-openjdk/jre/bin/java   1061      auto mode
  1            /usr/lib/jvm/java-6-openjdk/jre/bin/java   1061      manual mode
* 2            /usr/lib/jvm/java-6-sun/jre/bin/java       63        manual mode

Press enter to keep the current choice[*], or type selection number: 

The JDK is not listed, but it is listed on disk:

alex@alex-home:~$ ls /usr/lib/jvm/
default-java  java-1.6.0-openjdk  java-6-openjdk  java-6-sun  java-6-sun-1.6.0.22

UPDATE:

Installing plugin and fonts caused update-java-alternatives to stop complaining, but still no luck:

sudo apt-get install sun-java6-plugin sun-java6-fonts

Then:

alex@alex-home:~$ sudo update-java-alternatives -s java-6-sun 
alex@alex-home:~$ java -version
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03, mixed mode)

UPDATE 2: Hmm, maybe its actually working? I thought "…SE Runtime…" meant JRE, but maybe its all good?

Best Answer

The SE Runtime means that you're running Java Standard Edition, rather than Enterprise Edition (AKA Servlets/JSP, which need an application server). You should be just fine with what you have installed right now! If you want to develop Java programs, just make sure that javac is installed on your system.

EDIT Also, make sure that javac is being provided by java-6-sun, otherwise you'll probably be using the GNU Java compiler which doesn't seem to be what you want.

Related Question