Monday, January 9, 2012

Oracle (Sun) Java 6 in Ubuntu 10.04 LTS


First Part:
  1. Download *rpm.bin package from official site. Try to install it and it fails with unpacked rpm package.
  2. Convert with alien: alien --scripts ./jre-6u30-linux-amd64.rpm
  3. dpkg -i jre_1.6.030-1_amd64.deb
  4. update-alternatives --get-selections |grep java
  5. update-alternatives --install "/usr/bin/java" "java" "/usr/java/default/bin/java" 1
  6. update-alternatives --set java /usr/java/default/bin/java
  7. update-alternatives --list java to check
  8. update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/java/default/bin/java" 1
  9. update-alternatives --set javaws /usr/java/default/bin/javaws
 Second part - browser plugin:
Google chrome found plugin without problems. The steps for Firefox are following:
  1. Check what's in /usr/lib/mozilla/plugins/ and remove open jdk icedtea or whatever. Name "libjavaplugin.so" is important. 
  2. Simply link it this way:

ln -s /usr/java/default/lib/amd64/libnpjp2.so /usr/lib/mozilla/plugins/libjavaplugin.so

Or use update-alternatives:

update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin" "/usr/java/default/lib/amd64/libnpjp2.so" 1
update-alternatives --set mozilla-javaplugin "/usr/java/default/lib/amd64/libnpjp2.so"

 Third part. Don't forget about Look&Feel:

(Default Ubuntu location)
/etc/java-6-sun/swing.properties
# uncomment to set the default look and feel to GTK
swing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel

(New with authintic Java install):

/usr/java/default/lib/swing.properties 
# uncomment to set the default look and feel to GTK
swing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel

set JAVA_HOME=/usr/java/default; in /etc/environment or export in .bashrc