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.2008-06-12)

413.   How can I solve Cisco Catalyst 3550 series issues where a port seems to have died?   [jake/2004-08-23]
384.   Where can I find good undergraduate summer research/internships?   [virgil/2003-10-03]
366.   What is a really good german street map website?   [jake/2003-07-10]
337.   you ever watch Jem and the Holograms?   [virgil/2002-11-24]
314.   How can you talk to deaf people on the phone? (Thanks Mr. Jeff Young)   [jake/2002-05-11]
283.   What is the beautiful font used in the movie "Bicentennial Man" ?   [rupe/2001-11-09]
242.   What bugs exist in the Nokia 7190 firmware?   [rupe/2001-07-17]
241.   What the hell does [U:a:S:b:h] mean?   [mennonite/2001-06-05]
187.   So when's the BIG PARTY?   [strick/2002-01-23] ( nana/2001-03-22 nana/2001-03-21 macki/2001-03-04 )
167.   What are the hardware specs on a Cybiko?   [rupe/2001-01-24]
108.   How can i get custom ring tones onto my cell phone?   [jesse/2000-07-09]
98.   What are the rules for SHOTGUN?   [strick/2000-05-18]
94.   How do I boot my Sparc Classic/Sparc Classic X/Sparc 5/Sparc 10 without a keyboard or monitor?   [rupe/2000-05-12]
69.   What is the origin of The Yak?   [strick/2000-02-28]
66.   What's an altavistincantation?   [strick/2000-02-22]
41.   Which OS Sucks? Which OS Rules?   [strick/2000-02-02]
13.   What internet security sites should I read?   [strick/2000-01-17]