Showing posts with label java. Show all posts
Showing posts with label java. Show all posts

Wednesday, January 23, 2008

Enabling JUnit Testing in Eclipse for Ubuntu

After installing Eclipse from the official Ubuntu packages for Ubuntu 7.10 (Gutsy Gibbon), the JUnit test integration does not work. When you attempt to run a JUnit Test, you will receive an error message like:

An internal error occurred during: 'Launching'

To resolve this error, you will need to update from the Eclipse repository outside of the Ubuntu package management tools. Follow these steps to install the Eclipse updates:

1. Open a terminal, and type:
sudo eclipse

Note that you need to use sudo; if you do not, you will not be able to install the updates. When prompted, keep the default workspace location and click "OK".

2. Choose "Help -> Software Updates -> Find and Install..." from the Eclipse menu bar.

3. Leave "Search for updates of the currently installed features" selected, and click on "Finish".

4. When prompted, choose the mirror that is closest to you, or scroll to the bottom of the list and choose "The Eclipse Project Updates". Click "OK" when you have chosen the mirror you wish to use.

5. Eclipse will download information about the available updates. When finished, it will display a dialog allowing you to select the features to install/update. Leave the defaults selected, and click on "Finish".

6. When prompted, accept the license agreement.

When installation is complete, exit out of eclipse, and launch it again from your Applications menu in Ubuntu. You should now be able to run JUnit tests using Eclipse's JUnit support.

Tuesday, January 22, 2008

Installing Apache Maven 2 on Ubuntu 7.10 Desktop

The Maven software project management tool is indispensable for managing the build process, reporting and documentation for Java development projects. Naturally, one of the first things I wanted to do on my new project was set up the build environment. Unfortunately, Maven is not available as a package for Ubuntu 7.10. It is available in the current unstable release (Hardy Heron).

To install Maven on Ubuntu 7.10, download the following packages from Hardy Heron:

maven2
libdoxia-java
libplexus-container-default-java
libclassworlds-java
libplexus-velocity-java
libjtidy-java
libplexus-interactivity-api-java
libplexus-component-api-java
libplexus-classworlds-java
libplexus-utils-java
libwagon-java


When all of the packages are downloaded, open a terminal and navigate to the directory that contains the packages. Execute the following command:

dpkg -i *.deb
Update: Per some comments, it may be necessary to execute the following command as well:

sudo apt-get install -f


dpkg will download the remaining dependencies and install all of the packages. When installation has completed, you can verify that Maven is installed and working by typing:

mvn --version


You should see something like:

Maven version: 2.0.8
Java version: 1.5.0_13
OS name: "linux" version: "2.6.22-14-generic" arch: "i386" Family: "unix"