Tuesday, October 12, 2010

Linux For Java Developers

My XP install had gotten rather old, worn and slow and I decided to take the opportunity investigate alternate OSs and dust off my Linux skills.
  • Which distribution should I try?  Ubuntu? Red Hat Fedora? Gentoo? (I'm leaning toward Ubuntu.)
  • Can I get Eclipse? Does Eclipse work the same?  
  • There is a version of NetBeans. Should I use it?
  • Can I replace my favorite tools, find better ones or find a Linux version of the same ones?
  • Can XP and Linux coexist?  
  • How much free space do I need 
  • Where is my Partition Magic disk?
  • I hope I don't destroy my Windows partition.

The short of it is that I did get Ubuntu up and running, familiarized myself with the OS and figured out how to install the JDK and Squirrel DB Client in about 6 hours.

It wasn't particularly easy to figure everything out, but after all the legwork and documenting my steps, it's relatively easy to do.  ...So that's not a deterrent. Hopefully it will be easier when it comes to setting up Eclipse (or NetBeans) and my other tools.

Part of the frustration is that (surprisingly) there isn't much good documentation out there specifically about setting up Ubuntu for Java Development.  Also, a good portion of the 'Ubuntu+Java' search results apply to setting up the JRE rather than the JDK.

The first thing to get over is the way applications are packaged into repositories (think Maven) and how they are installed on Ubuntu.  You don't have to use the repositories and the "Software Sources" tool but much of the documentation refers to it. Developers who are new to Ubuntu should review these concepts first to avert much frustration.



Here's the long of it....


First Stab --Make a Bootable Ubuntu USB Stick
I recommend this approach because it is easy and you don't have to change hard drive partitions or anything -- just boot Ubuntu from the USB drive. Get a 4GB USB drive you don't mind formatting, and format it with Ubuntu.  This will be used to boot up a workstation --no messing around with partitions. The installation instructions on Ubuntu were relatively straightforward. Start here at the download site, select USB stick and click on the "Show Me How" button.  You will be instructed to download the Universal USB Installer and use it to make the USB stick into a bootable Ubuntu Linux desktop.

It probably took about 4 hours total to be booting into a working Linux system. Luckily the distribution comes with FireFox (also Open Office) and of course a way to get to the command line. All-in-all it took about 6 hours to get somewhat comfortable with the system. (I took a Linux class using Red Hat a few years ago so I have some vague memories of installing using RPM.)
 
I also didn't know how to obtain and install new applications that I need. Coming from the Windows world I was tempted to just go download the install files and run them.  Not so fast --  to install software on Ubuntu you don’t just download and run installer files. With Ubuntu you get software from Ubuntu "repositories". This part is really frustrating because there isn't much documentation on this --AND as I mentioned the USB bootable version is rather slim and doesn't have many of the "dependent" "packages" that the JDK or many of the tools I want to install.  I tend to try the command line tools and the apt tool just gives up if it can't find depended upon packages and IMHO doesn't do a very good job of helping you find those dependent files.

The USB version is slim (I allocated 4GB)

Ubuntu does not come with a Java Development Kit installed. You need to install a fuller version of Ubuntu rather than just booting a PC from the USB version.  That means finding space on the hard drive and partitioning it for the Ubuntu OS.

Now the question is: Should I use Ubuntu or look at alternate Linux distributions. I haven't found much in the way of recommendations for a particular Linux distro, or even much discussion of how to get Java running. There seems to be more concern about whether to use the GPL Java or the Sun Java (never even thought about that one on Windows).


Update 10/13/2010:
Today I pretty much trashed my XP installation trying to resize my disk partition and decided to just go with Ubuntu 10.04 LT on the whole 40 GB.  As directed by the Ubuntu documentation I downloaded the Ubuntu ISO image, created a CD using infraRecorder and booted the PC with it.

Everything so far is going very well.  Synergy works, vsFTP works...

This works! How to install JDK 1.5.0_18-b02 on Ubuntu:

Edit your sources.list file.
  1. Open up the terminal and type in “sudo vi /etc/apt/sources.list” . 
  2. Go to the end of the file and add
  3. deb http://us.archive.ubuntu.com/ubuntu/ jaunty main multiverse universe restricted
  4. Save it and close the text editor. 
  5. In the terminal, type > sudo apt-get update
  6. After that >sudo apt-get install sun-java5-jdk
Low and behold! That works!

Next to try Eclipse, Ant, Git, jUnit, etc.


References:
More References:

No comments:

Post a Comment

Followers