W3C home > Mailing lists > Public > www-jigsaw@w3.org > January to February 1999

Re: Jigsaw happiness

From: Christopher William Turner <cwturner@cycom.co.uk>
Date: Wed, 27 Jan 1999 04:51:37 -0500 (EST)
Message-ID: <36AEE020.9ACC2D80@cycom.co.uk>
To: Kenneth Persson <kenneth@veosystems.com>
CC: www-jigsaw@w3.org
The myServlets.jar just needs to be in the classpath when jigsaw starts up.
When you use jigadm to define the servlets, just specify the full class name of
servlet in the appropriate attribute.

An alternative method which I use on java 1.2 is to do everything in java. Java
allows java code to redirect out and err streams, load jars, classes  and
discover and call methods. You could write code to dynamically discover and load
jars. No script files or
constants are involved.

I attach my source code and here is the relevant extract:-
    try {
  URLClassLoader ucl = URLClassLoader.newInstance(a.urls);
  Class c=null;
  try {
      c = ucl.loadClass(a.className);
  } catch(ClassNotFoundException cnfe){
      System.err.println("class "+a.className+" not found in
  } else {
      Class argTypes[] = new Class[1];
      argTypes[0] = args.getClass();
      Method main = c.getDeclaredMethod("main", argTypes);
      PrintStream newErrStream = new PrintStream(new
      PrintStream newStdStream = new PrintStream(new
      main.invoke(null, newArgsArray);
     } catch(NoSuchMethodException nsme){
  System.err.println("method main(String []) not found in class
     } catch(InvocationTargetException ite){
  System.err.println("static invocation of main() failed in class
     } catch(IllegalAccessException iae){
  System.err.println("access denied to main() in class "+a.className());

Chris Turner, http://www.cycom.co.uk/

Received on Wednesday, 27 January 1999 05:07:01 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:25:33 UTC