Ubuntu Install for Java Programmers
Tue, 27 Jun 2006 06:23 PM GMT

I am giving Ubuntu a try again (the first time I tried it, I suffered through network card configuration hell and bailed). I plan to use the new 6.06 LTS (a.k.a Dapper Drake) version since so much has been made in the Java blogosphere about how easy it is to use. It also comes packaged with Java integration.

The new Ubuntu Linux distro is amazing stuff - you can download the CD from Ubuntu, and boot from the CD, which allows you to give Ubuntu Linux a try without making changes to the hard drive! Run with it and play around; your Windows OS will have no idea that you are cheating on it. If you do decide to make the final commitment, a simple click on the install icon in the upper left hand side of the desktop does the trick. Oh, and get this.... you can browse internet while you are installing your brand new Ubuntu Linux OS! *JAW DROP*

The setup is going fine so far (I am at 82% at the time of writing this paragraph). I did find one crucial caveat during install - do not install Ubuntu Linux while you have USB devices plugged in or you will go into hang up mode during the "Prepare Disk Space" phase of the install. If, by chance, you are here at my blog post because you are sweating bricks over hanging and Google told you to come here, let me tell you that I just unplugged my USB devices during the "Prepare Disk Space" phase and it installed fine. *BUT THAT IS JUST ME....WARNING: I URGE YOU NOT TO TAKE THIS HUMBLE BLOG ENTRY AS A SOLUTION....please go to the pros at ubuntuforums.

Well, it looks like I am done with the install. Let me check out my "preinstalled java". OK. I get a terminal out. I’ll type in 'java -version' here. Now I get the following....

danno@danno-laptop:~$ java -version
java version "1.4.2"
gij (GNU libgcj) version 4.1.0 (Ubuntu 4.1.0-1ubuntu8)

Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
danno@danno-laptop:~$

Hmm....so it's 1.4.2. No big deal. I am happy to see this here though. It's a great sign that Java is everywhere.

OK, marching on. I want to see if I can de-install this Java 1.4.2 and install the Java 6.0 Beta. I think I’ll go into the "Synaptic Package Manager" and try to de-install it there....Oh, OK, maybe that wasn't such a good idea. It seems that Java is installed and relied upon by Bean Shell (bsh) and OpenOffice. Interesting....

What now? Well, after a bit of Google research, I learned that someone named mjreged on Ubuntu forums has found a way to install Java 6.0 Beta 2. He recommends the following:

I work with Netbeans and ubuntu on daily basis and this is what i do :

1) download JDK example: jdk1.6.0-beta2.bin into your home folder
2) in terminal run : ./jdk1.6.0-beta2.bin (make sure to chmod +x so that it can actually run)
result : you will get a folder in home such as jdk1.6.0/
3) in terminal run : sudo mv jdk1.6.0 /opt
result : you just moved jdk1.6.0 into /opt folder so now /opt/jdk1.6.0 is the location of the jdk

4) in terminal run : sudo rm /usr/bin/java
result: remove any link that is in your system path for java so you can replace it with the jdk in /opt
5) in terminal run : sudo ln -s /opt/jdk1.6.0/jre/bin/java /usr/bin
result : made a link to your new jdk so that it is easy to be found by other programs like azureus or limewire

6 ) dowload the latest snapshot of netbeans ex. nebeans 6.0
7) in terminal run : ./nebeans6.0-blahblahblah.bin
result : netbeans installer will find you jdk and will use it for installation of the IDE
at the end of installation you should have an icon on your desktop for nebeans that uses java JDK that you placed in your /opt/jdk1.6.0 folder

Note : jdk1.6.0 is a development build, so is netbeans 6.

in netbeans folder structure you can find a file ~/netbeans6/etc/netbeans.conf
in there you can also point to a jdk of your choosing
like this : netbeans_jdkhome="/opt/jdk1.6.0"

Fantastic! It worked according to plan. I tried out OpenOffice, albeit not thoroughly, and nothing was broken. mjreged, you are a genius!

In addition to the mjreged’s directions, I added a command so that javac is available at the terminal:

danno@danno-laptop:~/Desktop$ sudo ln -s /opt/jdk1.6.0/bin/javac /usr/bin

That's all there is to installing Java on Linux. I do have to brag that on my duo-core machine, the whole unpacking process took less than 30 seconds. Yowsa!

4 comments for Ubuntu Install for Java Programmers
atleta
Tue, 27 Jun 2006 08:55 PM GMT

So what_ I thought you would be talking about how to install java properly (i.e. using the package manager) under Ubuntu. As ubuntu is a debian based distro I guess make-jpkg should do the trick (it's in java-package I guess). make-jpkg turns the official jvm installs into deb packages that you can install (and later _remove_) with dpkg
Conny
Wed, 28 Jun 2006 07:37 AM GMT

I recently reinstalled Ubuntu on my laptop, and after some research this is how I set up Java (Mustang beta).
Add the following to your /etc/apt/sources.list deb http://ftp.debian-unofficial.org/debian/ sarge main contrib non-free restric ted Do an apt-get install sun-j2se-XX (can’t remember the exact package name)
Do a
update-alternatives --config java
and
update-alternatives --config javac

You should be set with a working mustang installation.
Anonymous
Wed, 28 Jun 2006 02:12 PM GMT

Ubuntu has Sun JDK/JRE package in multiverse repository, so you don't need to run make-jpkg.
Swapnonil Mukherjee
Wed, 28 Jun 2006 08:27 PM GMT

Hi Guys,
I run both jdk1.5 and jdk1.6.
Infact the jdk1.6 font rendering is so much better that I use it for my Netbeans,Intellij and jEdit as well.
Take a look at these screenshots

http://www.flickr.com/photos/smukherjee/tags/ubuntu/

If you want to customize Ubuntu's own font rendering so that it looks as crisp as Windows XP, then follow this guide.

A guide to beautiful & crisp fonts in Linux.

This basically talks about re-compiling libfreetype.so to achieve this effect. He bases his guide on Slackware, but I found that all those commands applies to and works on Ubuntu as well.