Sunday, September 30, 2007

Eclipse and Java SDK 1.5 on Debian Etch

As I am still trying to learn java, linux, perl, asterisk and everything I can get distracted with I needed to run eclipse on a new box I set up at home with Debian Etch.

I found the below page quite good on the details on how to achieve this. My steps are copied below:

http://www.crazysquirrel.com/computing/debian/java.jspx


$ apt-get -u install java-package
$ fakeroot make-jpkg java_ee_sdk-5_03-linux.bin

You will see the follwing output:
Creating temporary directory: /tmp/make-jpkg.fktzTQ6486
Loading plugins: blackdown-j2re.sh blackdown-j2sdk.sh common.sh ibm-j2re.sh ibm-j2sdk.sh j2re.sh j2sdk-doc.sh j2sdk.sh j2se.sh sun-j2re.sh sun-j2sdk-doc.sh sun-j2sdk.sh
Detected Debian build architecture: i386
Detected Debian GNU type: i486-linux-gnu
No matching plugin was found.
Removing temporary directory: done

The above command didn't work with the package
java_ee_sdk-5_03-linux.bin so first I tried to make it work. First use the command below to see you have the latest java package installed. I have .28 that is current enough.

$ apt-cache policy java-package | head -2
java-package:
Installed: 0.28

Second try to lie to the installer telling that the installation type if i386 (google arround the message of "plugin not found" and that was the advice). You do this step by entering the following line:

$DEB_BUILD_GNU_TYPE=[i386]-linux fakeroot make-jpkg java_ee_sdk-5_03-linux.bin
The trick is on hte DEB_BUILD_GNU_TYPE that you pass to the process. But as I was still using the java_ee_sdk-5_03-linux.bin from sun it didn't work because the problem was not the plugin but the USER (me) and instead of java_ee_sdk-5_03-linux.bin I should have been using jdk-1_5_0_12-linux-i586.bin. This is the JDK for what make-jpkg was done and after downloading it I was able to make it work.

$fakeroot make-jpkg jdk-1_5_0_12-linux-i586.bin

dpkg-deb: building package `sun-j2sdk1.5' in `/tmp/make-jpkg.trHEuC6948/sun-j2sdk1.5_1.5.0+update12_i386.deb'.
copy sun-j2sdk1.5_1.5.0+update12_i386.deb into directory /home/ricardo/java_source/
The Debian package has been created in the current directory. You can
install the package as root (e.g. dpkg -i sun-j2sdk1.5_1.5.0+update12_i386.deb).

Removing temporary directory: done
After that the package is done and now you only need to run dpkg to install it:
$dpkg -i sun-j2sdk1.5_1.5.0+update12_i386.deb


Check your Java Version just in case you have 2 and you have to use alternatives (explained in another blog) to select the Sun one as default and not the GNU one (usually installed but not in this case).

# java -version
java version "1.5.0_12"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_12-b04)
Java HotSpot(TM) Client VM (build 1.5.0_12-b04, mixed mode, sharing)



No comments: