by jake

Interested in using Java in Debian?

Today a friend pointed me to the debian package 'mpkg-j2se'. You will also need the package 'fakeroot' to get things done right.

Install those two packages: 'sudo apt-get install fakeroot mpkg-j2se'

If you're not using sudo, install it however you would normally.

According to the mpkg-j2se page:

"mpkg-j2se creates a Debian package from a Java(TM) 2 distribution. This program works with the latest Java(TM) Runtime Environments (RE) and Software Development Kits (SDK) Version 1.3, 1.4 and 1.5 from Sun Microsystems(TM) and Blackdown Java Linux."



You simply need to go to the java.sun.com page and find the package you want to install.

If you take a gander in '/usr/share/mpkg-j2se' and you will find a list of shell scripts that are designed as plugins for mpkg-j2se:
blackdown-j2re.sh common.sh j2sdk.sh sun-j2re.sh blackdown-j2sdk.sh j2re.sh j2se.sh sun-j2sdk.sh

If you're having trouble, you might want to read the script that should be loaded for your JVM/JDK package.

In my case, I decided that I wanted this package: Java VM, I grabbed "self-extracting" package for the JVM on the bottom. Unless you know better, that's the right package for you.

To make sure you have something similar, check that the file name is similar to:
'j2re-1_4_2_05-linux-i586.bin'.

Save the file to '/tmp/j2re-1_4_2_05-linux-i586.bin'

At which point, simply run the command:
'fakeroot /usr/bin/mpkg-j2se /tmp/j2re-1_4_2_05-linux-i586.bin'. This results in output similar to:

Creating temporary directory: /tmp/mpkg-j2se.XXXXR7MUU1
Loading plugins: blackdown-j2re.sh blackdown-j2sdk.sh common.sh j2re.sh j2sdk.sh j2se.sh sun-j2re.sh sun-j2sdk.sh

Detected product:
Java(TM) Runtime Environment (J2RE)
Standard Edition, Version 1.4.2+05
Sun Microsystems(TM), Inc.
Is this correct [Y/n]: Y


Checking free diskspace: done.


Please enter your full name. This value will be used in the maintainer field of the created package.

Full name: Jacob Appelbaum

Please enter a valid email address or press return to accept the default value. This address will be used in the maintainer field of the created package.

Email [jacob@appelbaum.net]:

In the next step, the binary file will be extracted. Probably a license agreement will be displayed. Please read this agreement carefully. If you do not agree to the displayed license terms, the package will not be built.

Press [Return] to continue:

At this point the EULA comes up from Sun, you must agree by scrolling to the bottom and typing 'yes'

Lots of things will scroll by your screen now: [...]
inflating: j2re1.4.2_05/README
inflating: j2re1.4.2_05/LICENSE
inflating: j2re1.4.2_05/THIRDPARTYLICENSEREADME.txt
creating: j2re1.4.2_05/man/
creating: j2re1.4.2_05/man/man1/
inflating: j2re1.4.2_05/man/man1/java.1
inflating: j2re1.4.2_05/man/man1/keytool.1
inflating: j2re1.4.2_05/man/man1/rmid.1
[...]
inflating: j2re1.4.2_05/javaws/resources/messages_zh_CN.properties
extracting: j2re1.4.2_05/javaws/sunlogo64x30.gif
Creating j2re1.4.2_05/lib/rt.jar
Creating j2re1.4.2_05/lib/jsse.jar
Creating j2re1.4.2_05/lib/charsets.jar
Creating j2re1.4.2_05/lib/ext/localedata.jar
Creating j2re1.4.2_05/lib/plugin.jar
Creating j2re1.4.2_05/javaws/javaws.jar
Done.

Testing extracted archive... okay.

Create debian package:
dh_testdir
dh_testroot
[...]
dh_builddeb
dpkg-deb: building package `sun-j2re1.4' in
`/tmp/mpkg-j2se.XXXX1hCDXC/sun-j2re1.4_1.4.2+05_i386.deb'.
copy sun-j2re1.4_1.4.2+05_i386.deb into directory /tmp/


The Debian package has been created in the current directory. You can install the package as root (e.g. dpkg -i sun-j2re1.4_1.4.2+05_i386.deb). You should also install the corresponding package with Debian specific parts (e.g. apt-get install sun-j2re1.4debian).


Removing temporary directory: done

Install it like so: 'sudo dpkg -i /tmp/sun-j2re1.4_1.4.2+05_i386.deb'


Simple.

I now have an easily upgradeable, easily manageable Debian package for my Java related needs! Amazing!

The only thing that you will want to modify is a few environment variables to take advantage of your new Java power. Also perhaps a symbolic link to allow your web browser to use the JVM as a plugin.

Add this to your ~/.bash_profile:

export JAVA_HOME=/usr/lib/j2re1.4-sun/
PATH="${PATH}:/usr/lib/j2re1.4-sun/bin/"


If you want to use the java plugin in Mozilla Firefox, you need to make a symbolic link: cd /usr/lib/mozilla-firefox/plugins/
sudo ln -s /usr/lib/j2re1.4-sun/plugin/i386/ns610-gcc32/libjavaplugin_oji.so libjavaplugin_oji.so


If you want to use the java plugin in Mozilla, you need to make a symbolic link: cd /usr/lib/mozilla/plugins/
sudo ln -s /usr/lib/j2re1.4-sun/plugin/i386/ns610-gcc32/libjavaplugin_oji.so libjavaplugin_oji.so


If you want to use the java plugin in Konqueror: Open the menu item 'Settings' and select 'Configure Konqueror'. Select the 'Java and JavaScript' and in the panel select 'Enable Java Globally' and select 'Show Java Console'.

You can give either an absolute path to the java executable or you can simply enter java (assuming your path is correctly setup).

Restart Mozilla, Firefox, Konqueror or whatever you're using and it should work. Check this by typing the URL 'about:plugins'

This allows you to use things like Mindterm and Java Anonymous Proxy with greater ease. Also this demonstrates that it's dead simple to install the Sun JVM on your machine in an easy to manage fashion.

 


 
Read more of   The Yak's Frequently Questioned Answers   (mod.2010-02-10)

441.   What is Conware?   [jake/2006-12-22]
425.   How do I make a FireFox search plugin?   [gregr/2005-05-17]
394.   I've heard of RTFM, but what does STFW mean?   [matt/2003-11-12] ( matthew/2004-08-11 )
337.   you ever watch Jem and the Holograms?   [virgil/2002-11-24]
287.   How do I make a VCD (Video CD)?   [combee/2001-11-19]
277.   What does K-Rad mean? is there a modern alternative to k-rad?   [mennonite/2001-10-08]
259.   What is #temp   [ross/2001-08-10]
215.   what is the maximum length of a file name in mac os 9?   [jesse/2001-04-18]
199.   Where can I find pictures of cool PC cases?   [rupe/2001-03-13]
195.   why wont my computer boot off of its hard drive?   [jesse/2001-03-11] ( strick/2001-03-12 )
191.   What did Jon Postel (IANA)'s obituary look like?   [rupe/2001-03-06] ( strick/2001-03-11 )
186.   Where can I find some neat open source artwork?   [rupe/2001-02-28]
178.   Why isn't my PCS email working on my Cingular/PB Wireless phone?   [rupe/2001-02-12]
132.   What is the official scale for grading Yak parties?   [rupe/2000-10-08]
106.   What is Wax?   [jamison/2000-07-03]
53.   Why is strick's favorite composer Dennis Báthory-Kitsz?   [strick/2001-05-13]
10.   are there ICKY THINGS on the internet?   [strick/2000-01-17]