JDK on Ubuntu

From KevinWiki

(Difference between revisions)
Jump to: navigation, search
Line 25: Line 25:
=== Java Advanced Imaging (JAI) ===
=== Java Advanced Imaging (JAI) ===
<pre>
<pre>
-
$ apt-get install libjai-core-java  
+
$ apt-get install libjai-imageio-core-java  
</pre>
</pre>

Revision as of 12:58, 24 February 2013

Contents

OpenJDK

OpenJDK is recommended over OracleJDK since OpenJDK can easily be maintained by Ubuntu development team.

Installation: JDK

  • OpenJDK 7
apt-get install openjdk-7-jdk 
  • OpenJDK 6
apt-get install openjdk-6-jdk 


Installation: JRE

  • OpenJDK 7
$ apt-get install openjdk-7-jre 
  • OpenJDK 6
$ apt-get install openjdk-6-jre 

Extensions

Java Advanced Imaging (JAI)

$ apt-get install libjai-imageio-core-java 

Oracle JDK

Installation of SUN JDK

Since Ubuntu 10.04 sun-java6-jdk is moved to the partner repository so it has to be added first if it is not in the source list. Open the /etc/apt/sources.list file and make sure the following line is there.

deb http://archive.canonical.com/ubuntu lucid partner 

If it's just added, do update first.

$ apt-get update 

then install it.

$ apt-get install sun-java6-jdk 

Installation of 32 bit JDK on 64 bit Ubuntu Linux

  • If it is not necessary to use the Java compiler, install ia32-sun-java6-bin instead.


  • Install java-package to build deb file from the JDK bin file downloaded.
$ sudo apt-get install java-package
  • Build deb file.
$ DEB_BUILD_GNU_TYPE=i486-linux-gnu DEB_BUILD_ARCH=i386 fakeroot make-jpkg jdk-6u7-linux-i586.bin 
  • Install the deb file (e.g. sun-j2sdk1.6_1.6.0+update7_amd64.deb) just created.

It can be done by either typing

$ sudo dpkg -i sun-j2sdk1.6_1.6.0+update7_amd64.deb

or double-clicking the sun-j2sdk1.6_1.6.0+update7_amd64.deb file

  • Change the JDK currently used to the one just installed.

See Update-alternatives


Problem Solving

  • If the version of JDK 6 to build deb file is 'update 10' or higher and the following error is occurred,
No matching plugin was found.

edit /usr/share/java-package/sun-j2sdk.sh file.


  • Find the following lines (search with the keyword "jdk-6u")
	"jdk-6u"[0-9]"-linux-i586.bin") # SUPPORTED
	    j2se_version=1.6.0+update${archive_name:6:1}${revision}
	    j2se_expected_min_size=130
	    found=true
	    ;;
  • Change to
	"jdk-6u"[0-9][0-9]"-linux-i586.bin") # SUPPORTED
	    j2se_version=1.6.0+update${archive_name:6:2}${revision}
	    j2se_expected_min_size=130
	    found=true
	    ;;


  • Build the deb file again
$ DEB_BUILD_GNU_TYPE=i486-linux-gnu DEB_BUILD_ARCH=i386 fakeroot make-jpkg jdk-6u7-linux-i586.bin
Personal tools