2

I realized that my java compiler wasn't up-to-date on my ubuntu 12.04

$ sudo update-alternatives --config javac
There are 2 choices for the alternative javac (providing /usr/bin/javac).

  Selection    Path                      Priority   Status
------------------------------------------------------------
* 0            /usr/bin/gcj-wrapper-4.6   1046      auto mode
  1            /usr/bin/ecj               143       manual mode
  2            /usr/bin/gcj-wrapper-4.6   1046      manual mode

$ sudo update-alternatives --config java
There are 3 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                           Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-6-openjdk-i386/jre/bin/java   1061      auto mode
  1            /usr/bin/gij-4.6                                1046      manual mode
  2            /usr/lib/jvm/java-6-openjdk-i386/jre/bin/java   1061      manual mode
* 3            /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java   1051      manual mode

I wonder which compiler is the best or most up-to-date, and which I shall use?

I am looking for a up-to-date one. Some said that Oracle's JDK is better than OpenJDK, so i downloaded jdk-7u67-linux-i586.tar.gz. After extract it, I am looking for how to install it. But I can't find it. But there are executables under the subdir bin:

/tmp/jdk1.7.0_67$ ls *
COPYRIGHT  LICENSE  README.html  release  src.zip  THIRDPARTYLICENSEREADME-JAVAFX.txt  THIRDPARTYLICENSEREADME.txt

bin:
appletviewer  jar        javafxpackager  jcmd      jinfo    jrunscript  jvisualvm     policytool   serialver   wsimport
apt           jarsigner  javah           jconsole  jmap     jsadebugd   keytool       rmic         servertool  xjc
ControlPanel  java       javap           jcontrol  jmc      jstack      native2ascii  rmid         tnameserv
extcheck      javac      java-rmi.cgi    jdb       jmc.ini  jstat       orbd          rmiregistry  unpack200
idlj          javadoc    javaws          jhat      jps      jstatd      pack200       schemagen    wsgen

db:
3RDPARTY  bin  lib  LICENSE  NOTICE  README-JDK.html  RELEASE-NOTES.html

include:
classfile_constants.h  jawt.h  jdwpTransport.h  jni.h  jvmticmlr.h  jvmti.h  linux

jre:
bin  COPYRIGHT  lib  LICENSE  plugin  README  THIRDPARTYLICENSEREADME-JAVAFX.txt  THIRDPARTYLICENSEREADME.txt  Welcome.html

lib:
ant-javafx.jar  dt.jar  ir.idl             javafx-mx.jar  jexec           orb.idl     tools.jar
ct.sym          i386    javafx-doclet.jar  jconsole.jar   missioncontrol  sa-jdi.jar  visualvm

man:
ja  ja_JP.UTF-8  man1

and bin/javac seem can compile java code.

So do I need to install it?

WHere shall I store the installations?

Shall I replace my old javac and other Java-related executables with those of this new package?

Thanks

Tim
  • 25,177

1 Answers1

1

I had problems with openjdk (some apps didn't work) so i'm using oracle jdk now.

Follow the instructions sachin pointed out. You can continue installing it by hand if you really want to ("the manual way" in the answer), but i don't think it's worth the trouble. Just scroll down to "the easy way" and it's as simple as:

$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java7-installer 

(or oracle-java6-installer for java6 etc)
It'll download the oracle package and take of integrating it nicely with ubuntu.

lemonsqueeze
  • 1,634