Category Archives: Development Tools

Creating a Shortcut to Eclipse on the Ubuntu Unity Dock

If you use Eclipse on Ubuntu, you will probably have found that the version in the Ubuntu repositories doesn’t have all the plugins you’re used to, and will have installed Eclipse from a download at eclipse.org

If this is the case, you can create a shortcut launcher to Eclipse using the gnome-desktop-item-edit application enabling Eclipse to be pinned to the Unity Dock. gnome-desktop-item-edit isn’t installed with a clean copy of Ubuntu however. To install run the following:

$ sudo apt-get install gnome-panel

After installation, you can create a new launcher by executing the following command:

$ gnome-desktop-item-edit --create-new ~/.local/share/applications

This will cause the following window to be displayed.

Unity Launcher

Enter all the relevant details into the window (including selecting the icon) and press OK. This will create an Eclipse launcher. If you then navigate to this folder, you can drag and drop the Eclipse icon onto the Dock to create the pinned shortcut to Eclipse.

Using GlassFish from Eclipse

When I think of developing apps using GlassFish, I usually think of using NetBeans for the development. As you’d expect however, Oracle provides some good tooling to allow you to develop against GlassFish from within Eclipse – even to the point of installing the application server directly from within Eclipse.  So, how is this done?

Installing GlassFish Server Tools

Contrary to what you’d expect, to install GlassFish tooling, you don’t use the Eclipse Marketplace for installation.  To install, right click within the “Servers” pane and select “New | Server” to display the “Define a New Server” dialog. On this dialog, select “Download additional server adaptors” and in the resulting dialog select “Oracle GlassFish Server Tools”.GlassFish Server Tools

After accepting the licence conditions, the GlassFish Server tools will be downloaded upon which you’ll need to restart Eclipse to complete the installation.

Defining a GlassFish Instance

After a restart, opening the ”Define a New Server” dialog will show that GlassFish support has been added.

Define New Server

Choose the GlassFish server you wish to use and press the “Next” button.  On the resulting dialog, you can choose to locate an existing copy of GlassFish, or install an new instance via the “Install Server” button if you don’t already have GlassFish installed.

GlassFish Runtime

One point to note here is that, if you install a new instance of GlassFish, you may then need to browse through the install folder to locate the “glassfish” folder within.  You will see that this is necessary because the “Next>” button will be disabled as you’ve installed an instance of GlassFish, but not correctly identified its location to Eclipse.

When you’ve selected (and installed if necessary) a GlassFish instance, complete the wizard to define the admninistrator credentials of the server.

GlassFish Tools

After creating a GlassFish server instance in Eclipse, you can develop and test Java EE 6 applications against it.  The GlassFish tools provides additional support to assist in this.  For example, right clicking on the server in the “Servers” tab allows you to manage the server or get additional information or support.

GlassFish Tools

New wizards are also installed into Eclipse to assist when creating GlassFish facets such as JMS or JDBC resources as shown below.  These wizards are available on the standard “File | New | Other” dialog under the “GlassFish” folder.

GlassFish Facets

Eclipse – ‘Building workspace’ has encountered a problem

I’ve got a web project that uses some 3rd party JavaScript libraries.  Unfortunately whenever Eclipse (Indigo) builds the project, it gives an error “‘Building workspace’ has encountered a problem”.

Building Workspace has encountered a problem

The details of the error read:

Errors occurred during the build.
Errors running builder ‘JavaScript Validator’ on project ‘project’.
java.lang.NullPointerException

On first inspection, it looks as though the solution would be to edit the JavaScript validator preferences and make it a bit less verbose.  Unfortunately though, there doesn’t seem to be any options in Eclipse to do this.

One solution though appears to be to edit the project Builders (Right click on Project, select “Properties” | “Builders”) and un-tick the JavaScript Validator option.

When you do this, Eclipse complains that this is an advanced operation and may cause side effects, so it doesn’t feel like the correct way to progress to me.  Having said that, it does eliminate the problem and allows Eclipse to build the project without NPEs.

Has anyone else experienced this problem and have a workaround that doesn’t involve disabling the ‘JavaScript Validator’ Builder, or is this the best approach in this situation?

Running JBoss Tools in Eclipse 3.6, Helios

With the release of a new version of Eclipse, its natural to download it and start using it straight away. One of the main problems doing this however, is that plugins aren’t always guaranteed to work with the new version of Eclipse. This is the case with JBoss Tools.

Fortunately however, you can install the JBoss Tools nightly builds as these are now compatible with Eclipse Helios. The easiest way to install JBoss Tools Nightly on Helios is via the update center at:

http://downloads.jboss.org/jbosstools/nightly/trunk/

When I first attempted to install JBoss Tools on Helios though I got the following error:

An error occurred while installing the items

session context was:(profile=epp.package.jee, phase=org.eclipse.equinox.internal.p2.engine.phases.Install, operand=null –> [R]org.mozilla.xpcom 1.9.1.2a, action=org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions.InstallBundleAction).

The artifact file for osgi.bundle,org.mozilla.xpcom,1.9.1.2a was not found.

Eclipse was complaining that xulrunner could not be found. Unfortunately this is not available for the 64-bit version of Eclipse on Windows, so the simple solution is to download the 32-bit version of Helios and use that instead. When I did this, JBoss Tools installed correctly with no problems.

According to Max Andersen, the JBoss Tools team are going to make installing xulrunner optional (at the expense of the visual page editor), in which case it would be possible to install on a 64-bit JVM.

Starting the Java DB in GlassFish

I’ve been doing a lot of development in NetBeans 5.5 beta 2 recently using Glassfish as my target application server. When doing development, its often quite useful to use the Derby DB bundled within Glassfish. As you’d expect from a modern IDE, NetBeans makes this easier for you by starting the database automatically so you don’t need to worry about it. When you deploy your application to a standalone Glassfish that isn’t “controlled” via NetBeans, you will probably find that the Derby DB doesn’t start automatically when Glassfish starts. Starting the DB is easily done from the command prompt though using the command:

asadmin start-database