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.

1 comment:

Nick said...

Many thanks for this hint - I've been struggling with getting Ubuntu's Eclipse to run JUnit tests for a while. This has been a great help!