book icon Everything you need to know about cloud printing

Choose your language

Choose your login

Contact us


Gotta love open source … I fixed it myself

I’m currently using the excellent Eclipse Java IDE for development work, and using the Jetty Launcher plugin to enable firing up the Jetty web server within Eclipse. It allows you to debug your web application directly in the IDE, making Java web development much smoother.

Unfortunately the current version of the Jetty Launcher does not work with the latest Jetty release (5.1), and Jetty 5.0 doesn’t seem to be available for download anymore. I searched the issue database at SourceForge and found that the issue had been reported by Marino Jonsson , and he suggested a possible fix. But there was no response from the project owner. The plugin is open source, so I figured I should get the source, code up the fix and build the project for myself.

I haven’t done any Eclipse Plugin development, so it took some fiddling with the Ant build.xml to get the plugin to build (the Eclipse jars could not be found when compiling). The result is a jettylauncher.jar that you can drop into your Jetty Launcher 1.2.1 directory and overwrite the old one (in [eclipsedir]/plugins/com.iw.plugins.jettylauncher_1.2.1).

If you’re interested in what I changed, here’s the unified diff …

diff -u -r1.9 — 29 Aug 2004 16:42:37 -0000 1.9 +++ 17 Feb 2005 12:21:53 -0000 @@ -29,6 +29,8 @@ import; import; import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import; import; import; @@ -303,7 +305,8 @@ */ public static String getJettyVersionString(File jarLocFile) throws MalformedURLException, ClassNotFoundException,

  • InstantiationException, IllegalAccessException, NoSuchFieldException
  • InstantiationException, IllegalAccessException, NoSuchFieldException,
  •    NoSuchMethodException, InvocationTargetException
    ```\{ ClassLoader currentClassLoader = null; currentClassLoader = Thread.currentThread().getContextClassLoader(); @@ -314,10 +317,20 @@ URLClassLoader jarClassLoader = URLClassLoader.newInstance( new URL\[\]\{jarLocFile.toURL()\}, currentClassLoader); Class versionClass = jarClassLoader.loadClass("org.mortbay.http.Version");
  • Object version = versionClass.newInstance();
  • Field versionImplField = versionClass.getField("\_\_VersionImpl");
  • String versionString = (String)versionImplField.get(version);
  • return versionString;

  •    String versionString;

  •    try {
  • 	Object version = versionClass.newInstance();
  • 	Field versionImplField = versionClass.getField("\_\_VersionImpl");
  • 	versionString = (String)versionImplField.get(version);
  •    } catch (NoSuchFieldException e) {
  •        // This must be Jetty 5.1+
  •        Method method = versionClass.getMethod("getImplVersion", null);
  •        versionString = (String) method.invoke(null, null);
  •    }

  •    return versionString;



Subscribe for the latest in print management and product updates!

By filling out and submitting this form, you agree that you have read our Privacy Policy, and agree to PaperCut handling your data in accordance with its terms.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.