Posts Tagged ‘Eclipse’

Fixing Eclipse Update Issues

// March 2nd, 2010 // No Comments » // Dev, Mobile

After a bit of a break, I’m about to start a stint of Blackberry development and really wanted to try out the new Blackberry JDE integration with Eclipse – something that promises to reduce the immense tedium of running Blackberry simulators somewhat. Anyone who has ever tried to do that will understand how valuable this could be, both financially (time is money after all) and to your sanity.

The plugin requires at least Eclipse 3.4, though, and I was stuck way back on 3.3. Eclipse was reluctant to update itself to any new version from any of the obvious “update” menu items, so I went for the simple brute force method:

  1. Zipping the old Eclipse app folder, then delete it
  2. Download the latest Eclipse, and add the latest version of whatever plugins are needed
  3. Reattach to the old workspace folder.

This initially appeared to work, but didn’t.

Ant Integration

The most visible problem was that Ant builds would no longer run. They’d start, and the red ‘stop’ button on the console would light up (indicating I could stop the running Ant process, not that it was stopped) but no logging at all reached the console. No dialogues appeared explaining the problem.

The clue lay in the workspace’s .metadata/.log file – there were two exceptions, at least one of which was being thrown every time I tried to run Ant:

!ENTRY org.eclipse.core.resources 4 75 2010-03-01 21:17:55.921
!MESSAGE Errors occurred during the build.
!SUBENTRY 1 org.eclipse.mtj.core 2 75 2010-03-01 21:17:55.921
!MESSAGE Errors running builder 'Preverification Builder' on project 'Framework'.
!STACK 1
org.eclipse.core.runtime.CoreException: Build state machine has not been initialized.

or

!ENTRY org.eclipse.ant.ui 4 120 2010-03-01 21:21:16.468
!MESSAGE Error logged from Ant UI:
!STACK 0
java.net.SocketTimeoutException: Accept timed out

Not, admittedly, much of a clue but enough to eventually track down the problem. Ant’s configuration – in particular, the locations of its jars – are stored in your workspace, despite it being a plugin integrated into Eclipse. If the location of Ant’s plugin folder changes, Ant stops working with this workspace.

To fix the problem, go to Preferences > Ant > Runtime. Remove all jars under Ant Home Entries, and then find the new versions in the Eclipse plugin folder (as an External Jar Location). Apply the changes, and your builds shoudl run again.

JavaME Emulation

The JavaME plugin is notoriously bad at introducing breaking changes whenever it updates. This time was no exception – my JavaME projects appeared fine in the IDE, but produced the following exception (to the console, at least) whenever a WTK emulator was run:

Running with storage root C:\Documents and Settings\Tom\j2mewtk\2.5.2\appdb\rms
Running with locale: English_United Kingdom.1252
Running in the identified_third_party security domain
java.lang.ClassNotFoundException: framework/midp/Application
	at com.sun.midp.midlet.MIDletState.createMIDlet(+29)
	at com.sun.midp.midlet.Scheduler.schedule(+52)
	at com.sun.midp.main.Main.runLocalClass(+28)
	at com.sun.midp.main.Main.main(+80)
Execution completed.

The fix turned out to be simple – delete the project, and check it out again. The new version will start with fresh metadata that works with the new plugin. Not very nice, but hardly fatal (if you’re using version control).

Incompatible Plugins

At the end of this, I discovered that the Blackberry JDE plugin does not support the very latest Galileo, so it was all a bit of a pointless exercise. Such is life in mobile development…

Running Subversion Through Ant

// May 28th, 2009 // No Comments » // Dev

Ant has a somewhat limited built-in Subversion task.  An alternative if you need more power (and I can’t quite remember why I did, but I did) is Subclipse’s ant task – but setting it up isn’t so obvious, especially if you don’t use Subclipse as your main Subversion plugin.

The Ant task provides a Java wrapper around two different ways to access Subversion: either a command line ‘svn’ command, or the JavaHL DLL.  Initially I opted for the former (using this Windows client) which appeared to work passably well, but generated reams of logging that slowed commits to a crawl; the Ant task didn’t allow you to pass additional command line parameters on to the command, so there wasn’t much that could be done about it.

An obscure bug, probably something to do with a slightly corrupted Subversion project in our repository, finally led me to reassess today, and after an afternoon of fun I scrapped the Windows client and went after the DLL.

To get it (and for some reason it took me a while to think of this), download the latest ‘update site’ zip for the latest Subclipse Eclipse plugin (currently 1.6.2), open it and pull out the four jar files with names starting org.tigris.subversion.clientadapter.  Note: don’t be distracted by the Update URL, which is the conventional way to actually install the plugin.

Drop these four jars in some suitable lib folder, and make sure they are added to Ant’s runtime classpath – in Eclipse, you do it from the Window > Preferences dialogue under Ant > Runtime:

Eclipse Ant dialogue

You can add them to the Ant Home or Global sections, it works either way.

Our entire automated tagging system now runs vastly quicker without the logging, and so far has been bug free even where the Windows client was balking about some off metadata thing (which is the only thing it didn’t adequately log, so no easy way to fix it). Excellent.