Tag Archives: java

Sun/Oracle Java on Ubuntu

Ubuntu Lucid Lynx (10.04) does not have the sun java repositories available by default.  You need to add them like this:

sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"

Then update the packages available:

sudo apt-get update

Then you can install Sun’s (Oracles?) Java

sudo apt-get install sun-java6-jdk sun-java6-jre sun-java6-plugin

Remote control debugging

If you are developing in java with eclipse then add this to the start up script of any apps you are developing -Xrunjdwp:transport=dt_socket,suspend=n,server=y,address=8993

You can then connect to them remotely using the Remote Java Application debug configuration in eclipse.  You can then use the eclipse debugger to step through any tricky code.

The application will start with “Listening for transport dt_socket at address: 8993” and you connect to it through this port. Inside eclipse you can add any jars, local projects etc. to the debugger as it steps into new classes and you can then view the code (and the application) as it runs.

Cross platform fun

While debugging some test problems with the T2 code I discovered some issues between OSX and Windows regards file paths and line breaks.  Seems that instead of just

inputs.put(“fileUrl”, LocalworkerTranslator.class.getResource( “/AAC4_HUMAN.sp”).getFile());

you have to ensure that the absolute path is correct by doing

URI uri = LocalworkerTranslator.class.getResource(“/AAC4_HUMAN.sp”) .toURI();

File newFile = new File(uri);

inputs.put(“fileUrl”, newFile.getAbsolutePath());

Also, you can’t expect checks for “\n” style line breaks to work in Windows because they insert things like “\r\n” instead.  So , you should use System.getProperty(“line.separator”) instead.

Launch your Browser

While developing the Taverna myExperiment plugin we needed some way of launching a browser when clicking on a link.  Launching a browser is fairly easy using Runtime.exec(“firefox”, URL);   However, how do you know what browsers are installed and what the default one is.  Step forward BrowserLauncher2 (http://browserlaunch2.sourceforge.net/).

BrowserLauncher launcher = new BrowserLauncher();


Job done.

Future visions

Writing a User Interface is quite often the hardest part of any development job. Everyone likes different look and feel and they seem to take forever to develop. I tend to hand code using Swing (Java’s default GUI) because I have not found an interactive GUI designer which I am comfortable with. In the (not so) distant past I used Delphi which had a really nice, intuitive GUI builder and I have also played around with the OSX development tools so why doesn’t Java have something as good. Maybe the old style application is dead and browser embedded GUIs are the way to go? The Nintendo Wii and the iPhone have shown what you can do with some lateral thinking (and a large budget). Check out http://www.cs.cmu.edu/~johnny/projects/wii/
and http://www.youtube.com/watch?v=0awjPUkBXOU&feature=related for a vision of the future.

The Taverna 2 (T2) development continues with the initial release planned for late June. Although most of the team are collocated on one site (Manchester University, UK), Taverna is an open source project. However, we have not had much “external” development for a while and this is something we will address with T2. The plan is for both user and developer forums nearer the time (real and virtual (maybe via irc)) and to promote T2 and it’s open source ideals at all the conferences etc. that we attend. One of the problems we face is having a governance regime which can handle external contributions in a controlled manner. There are lots of successful open source projects out there and they must have solved this problem. You can look forward to a “Vote for this feature” on the new look Taverna/myGrid website soon(-ish)!

Also, OMII-UK – which Taverna is part of – has been accepted as a mentoring organisation in this year’s Google Summer of Code. Maybe you would like to develop some cool code for us and the open source community!!