Sunday, November 24, 2013

Install java6 jdk from oracle binary instead of using "apt-get install sun-java6-jdk"


For Android platform development, we need java6.
But the guide is outdated. "sun-java6-jdk" is deprecated! ;-(

We have to find another way.


First of all, we need oracle java6 jdk binary.

The url is Oracle download page. You need your account on oracle.com for downloading it.
http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html#jdk-6u45-oth-JPR




tmax@tmax3:~/work/android$ chmod +x jdk-6u45-linux-x64.bin
tmax@tmax3:~/work/android$ ./jdk-6u45-linux-x64.bin
Unpacking...
Checksumming...
Extracting...
UnZipSFX 5.50 of 17 February 2002, by Info-ZIP (Zip-Bugs@lists.wku.edu).
replace jdk1.6.0_45/db/bin/ij? [y]es, [n]o, [A]ll, [N]one, [r]ename: A
  inflating: jdk1.6.0_45/db/bin/ij
  inflating: jdk1.6.0_45/db/bin/NetworkServerControl
  inflating: jdk1.6.0_45/db/bin/setNetworkClientCP.bat
  inflating: jdk1.6.0_45/db/bin/setEmbeddedCP.bat
  inflating: jdk1.6.0_45/db/bin/stopNetworkServer.bat
...

I set up my  environment by following (https://help.ubuntu.com/community/Java#Oracle_.28Sun.29_Java_6
 ). But I failed. Compiling failed with the error message below.
host Java: jsilver (out/host/common/obj/JAVA_LIBRARIES/jsilver_intermediates/classes)
Note: external/jsilver/src/org/clearsilver/FactoryLoader.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
jar: internal error:
java.io.FileNotFoundException: -C (No such file or directory)
   at gnu.java.nio.channels.FileChannelImpl.open(libgcj.so.12)
   at gnu.java.nio.channels.FileChannelImpl.<init>(libgcj.so.12)
   at gnu.java.nio.channels.FileChannelImpl.create(libgcj.so.12)
   at java.io.FileInputStream.<init>(libgcj.so.12)
   at gnu.classpath.tools.jar.Creator.writeFile(libgcj-tools.so.12)
   at gnu.classpath.tools.jar.Creator.writeCommandLineEntries(libgcj-tools.so.12)
   at gnu.classpath.tools.jar.Creator.writeCommandLineEntries(libgcj-tools.so.12)
   at gnu.classpath.tools.jar.Updater.run(libgcj-tools.so.12)
   at gnu.classpath.tools.jar.Main.run(libgcj-tools.so.12)
   at gnu.classpath.tools.jar.Main.main(libgcj-tools.so.12)
make: *** [out/host/common/obj/JAVA_LIBRARIES/jsilver_intermediates/javalib.jar] Error 1
make: *** Deleting file `out/host/common/obj/JAVA_LIBRARIES/jsilver_intermediates/javalib.jar'

The guide use "update-alternatives" utility for manual setup ("manual" means not-using-apt-get). It looks fancy. But something is wrong: conflict with pre-installed gcj java(GNU Compiler for Java). I could not fix it up. No idea about "update-alternatives".

So I just followed ( http://www.arndaleboard.org/wiki/index.php/O_WiKi#Installing_the_JDK). I set PATH=$JAVA_HOME/bin:$PATH in .bashrc. The site gave good resource.


1 comment:

stormcreator said...

Download page for JDK8 is http://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8-2177648.html