Friday, December 30, 2005

Java Development on Ubuntu

The following are from David Coldrick's Blog and I found it is usefull


Netbeans-5_0-beta-bin-linux.bin, make sure JAVA_HOME is defined, and run the .bin. For example:

export JAVA_HOME=/usr/lib/j2sdk1.5-sun/
./netbeans-5_0-beta-bin-linux.bin

Note: If the installer can't find the jdk - because you haven't set JAVA_HOME - you might get the message: "The wizard cannot continue because of the following error: could not load wizard specified in /wizard.inf (104)". Hmmm. Could be deemed rather obscure.

All going well, not only have you installed a fantastic IDE, but you even have an eye-catching little double-clickable launcher on your desktop. Sweet.

Java Application Server: If the only J2EE you're doing is servlets and JSPs, you can use the Tomcat server builtin to NetBeans. However, if you want to get into EJBs and Web Services, install this: it's very well integrated into NetBeans, it's free, and the next version, which will be supported by a future version of NetBeans, is open source.

Download, choosing "Sun Java System Application Server Platform Edition 8.1 2005Q2 UR2". The file will be something like sjsas_pe-8_1_02_2005Q2-linux.bin.

Make sure it's executable (chmod +x sjsas_pe-8_1_02_2005Q2-linux.bin if necessary), and run it. It will probably not be able to find your copy of java, so you can do either:

sudo ./sjsas_pe-8_1_02_2005Q2-linux.bin -javahome /usr/lib/j2sdk1.5-sun

or, as we did above:

export JAVA_HOME=/usr/lib/j2sdk1.5-sun/
sudo ./sjsas_pe-8_1_02_2005Q2-linux.bin

An install wizard will start, and away you go. Note that you can install without sudo, in which case the app server will be installed by default in your home directory, rather than in /opt.

To make the app server available from NetBeans, fire up NetBeans, go to Tools/Server Manager and Add… your server. Almost all of the server-related tasks you'll want to do can be done from within the IDE now, including – of course – deploying and debugging applications.

Other optional extras:

  1. If desired, change the memory available to NetBeans: edit {install directory}/etc/netbeans.conf, and change the line starting with "netbeans_default_options" to have the desired setting for min/max heap size. For example, on my 2GB laptop, I specify:
    "-J-Xms128m -J-Xmx256m"
  2. If you're interested in development for mobile devices, Download and install the mobility pack: for this beta, the file to download is netbeans_mobility-5_0-beta-linux.bin. Just run it, and the next time you run the IDE, you'll be able to create mobile projects. Lukas is on the mobility team, and has interesting and relevant blog entries
  3. A plugin you'll definitely want to install is the profiler: profiler-m9-linux.bin. Again, just run this to install the latest in profiling capabilities .
  4. Finally, by default, NetBeans uses the Metal look and feel on Linux. If you're a keen Ubuntu Gnome person, you might try the GTK L&F, by adding "-J-DuseGtk=true" (without the quotes) to the "netbeans_default_options" line in {install directory}/etc/netbeans.conf. So this line on my system now looks like:
    netbeans_default_options=”-J-Xms128m -J-Xmx256m -J-XX:PermSize=32m -J-XX:MaxPermSize=96m -J-ea -J-DuseGtk=true”

    Note that this is unsupported, but hey, so is running NetBeans on Ubuntu. One glitch I've found is that with the default "Human" theme in Ubuntu, menu items in Java using this L&F, when selected, disappear (or turn white on white, dunno which). My workaround, until I find out where the problem is, is to change the Ubuntu theme to Glider, which seems to work fine.

0 Comments:

Post a Comment

<< Home