Dec 15 2006

HOWTO: Installing Netbeans 5.5 on Ubuntu

Tag: HOWTO, Java, Linux, Software Engineering, UbuntuDan @ 11:19 pm

Netbeans is not currently available in the Ubuntu/Debian repositories. I believe this is because it uses the Sun CDDL licence which is considered incompatible with the GPL.

However, as an end-user you may wish to use Netbeans despite that. Although it comes with a neat installer wizard I personally prefer to try to get native .deb packages where possible in order to get native package management and menu/launcher icons. I found a debian packaged version by Daniel Baumann. It appears he put it on the Debian new queue but is wasn’t accepted. He’s made the prepacked binaries available here:

http://archive.daniel-baumann.ch/debian/packages/netbeans/5.5-1/

However, I wanted to learn something so I decided to try building a package using the current 5.5 source dist from Netbeans archive and Daniel Baumann’s debian package source. Here are the steps I took.

Building and Packaging Netbeans 5.5 for Ubuntu

1) Grab daniel-baumann’s patch here

netbeans_5.5-1.diff.gz

2) Get the Netbeans 5.5 source from:

http://www.netbeans.info/downloads/all.php?b_id=2180&src=1

I picked up the ’source’ tgz file from the table of links at the bottom of the page.

3) Untar the sources

  1.  
  2. mkdir netbeans
  3. cd netbeans
  4. tar -zxf netbeans-5_5-ide_sources.tar.gz
  5.  

4) Now apply the patch to the sources

  1.  
  2. # first decompress the patch
  3. gunzip netbeans_5.5-1.diff.gz
  4. cd netbeans-src
  5. patch -p1 < ../netbeans_5.5-1.diff
  6.  

The patch simply installs the debian packaging kit into the Netbeans 5.5 src directory. After applying you will find the new files under the newly created debian directory. For more info on what these files do see The Ubuntu Packaging Guide or the Debian New Maintainers Guide.

6) Next build the packages and install

  1.  
  2. debuild -uc -us
  3. sudo debi
  4.  

When debuild completes there will be 2 .deb files left in the directory above:

netbeans-ide_5.5-1_all.deb
netbeans-platform_5.5-1_all.deb

debi installs both files by reading the netbeans_5.5-1_i386.changes file which will have been generated in the directory above.


Dec 15 2006

HOWTO: Packaging Java 6 for Ubuntu

Tag: HOWTO, Java, Linux, Software Engineering, UbuntuDan @ 10:18 pm

Update: As of Fri 19th Jan 07 Java 6 has now been officially included into the Dapper Backports repository. See it’s package page.

Today I found out how to package Java for Ubuntu/Debian. I wanted to see if a .deb package file of Java 6 was available for Ubuntu I found details on creating one in the following forum post: Re: JDK 6 Available…now when is a deb coming?. The instructions there are great except they don’t work perfectly for Dapper so here are the modified steps for Dapper:

1) Patch ‘java-package’

The Debian Java Maintainers have created a tool make-jpkg which is a neat script to take the Sun Java native linux .bin installer and turn it into a .deb package. This script comes in the ‘java-package’ package which is in the multiverse repo in Ubuntu.

Dapper stocks the 0.27 version which does not support conversion of Java 6 yet. However, mlind attached a patch to his forum post (link above) to add support for Java 6 to java-package version 0.28. Luckily it’s not difficult to tweak the patch for 0.27. Here’s the modified version of the patch:

java-package_sun-java6.dapper.patch

Here’s the instructions on how apply the patch and build the updated package:

  1.  
  2. mkdir java-package
  3. cd java-package
  4. sudo apt-get build-dep java-package
  5. apt-get source java-package
  6. cd java-package-0.27
  7. patch -p1 < ../java-package_sun-java6.dapper.patch
  8. debuild -b -us -uc
  9. cd ..
  10. sudo dpkg -i java-package_0.27local0_all.deb

2) Package sun-jdk6

Now that you’ve updated java-package it’s time to package Java 6. First download Java 6 from Sun. You need to download the Linux self extracting file (jdk-6-linux-i586.bin). Here are the instructions on building it (taken from the forum post listed above).

  1.  
  2. mkdir sun-jdk6
  3. cd sun-jdk6
  4. # put jdk-6-linux-i586.bin into this directory
  5. make-jpkg jdk-6-linux-i586.bin
  6. dpkg -i sun-j2sdk1.6_1.6.0_i386.deb
  7. sudo update-alternatives –config java
  8. # select the new Java 6 installation as the provider of java
  9. java -version
  10. # Output of the above command should be
  11. # java version "1.6.0"
  12. # Java(TM) SE Runtime Environment (build 1.6.0-b105)
  13. # Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)