This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: define-simple-class and jars on the classpath?


Hi Per, thanks for the reply.

On Sat, Aug 26, 2006 at 10:56:56PM -0700, Per Bothner wrote:
> One possibility: Kawa uses reflection to "read" the Task class,
> so it needs to load the class.  I believe javac reads the actual
> class file, rather than using reflection.
> 
> Now I don't know why this might make a difference.  One possibility
> is that the Task class depends on other classes not in the classpath.
> javac doesn't need to read those, but they're needed when the class
> is initialized.

In that case the following would fail wouldn't it?

    import org.apache.tools.ant.Task;
    public class AntTest extends Task {
       public static void main(String []args) {
              AntTest a = new AntTest();
	      System.out.println("Test run: " + a + "\n");
       }
    }

But it works here.			

> You could also try to add a:
>   ex.printStackTrace();
> in the catch clause in gnu/expr/ClassExp.java where the error
> message is emitted.

That gives:

  (compiling AntTest.scm)
  java.lang.RuntimeException: no such class: org.apache.tools.ant.Task
        at gnu.bytecode.ObjectType.getReflectClass(ObjectType.java:76)
        at gnu.bytecode.ClassType.getModifiers(ClassType.java:70)
        at gnu.expr.ClassExp.setTypes(ClassExp.java:185)
        at gnu.expr.ClassExp.setParts(ClassExp.java:114)
        at gnu.expr.ClassExp.walk(ClassExp.java:579)
        at gnu.expr.ExpWalker.walk(ExpWalker.java:44)
        at gnu.expr.SetExp.walkChildren(SetExp.java:306)
        at gnu.expr.ExpWalker.walkExpression(ExpWalker.java:16)
        at gnu.expr.ExpWalker.walkSetExp(ExpWalker.java:72)
        at gnu.expr.SetExp.walk(SetExp.java:301)
        at gnu.expr.ExpWalker.walk(ExpWalker.java:40)
        at gnu.expr.LambdaExp.walkChildrenOnly(LambdaExp.java:1483)
        at gnu.expr.LambdaExp.walkChildren(LambdaExp.java:1471)
        at gnu.expr.ExpWalker.walkExpression(ExpWalker.java:16)
        at gnu.expr.ExpWalker.walkScopeExp(ExpWalker.java:59)
        at gnu.expr.ExpWalker.walkLambdaExp(ExpWalker.java:63)
        at gnu.expr.ExpWalker.walkModuleExp(ExpWalker.java:66)
        at gnu.expr.ModuleExp.walk(ModuleExp.java:341)
        at gnu.expr.ExpWalker.walk(ExpWalker.java:44)
        at gnu.expr.InlineCalls.inlineCalls(InlineCalls.java:13)
        at gnu.expr.Compilation.compile(Compilation.java:885)
        at gnu.expr.Compilation.compileToFiles(Compilation.java:955)
        at kawa.lang.CompileFile.compile_to_files(CompileFile.java:70)
        at kawa.repl.processArgs(repl.java:407)
        at kawa.repl.main(repl.java:728)
  Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.Task
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:242)
        at gnu.bytecode.ObjectType.getReflectClass(ObjectType.java:63)
        ... 24 more
  AntTest.scm:3:1: unknown super-type org.apache.tools.ant.Task

Cheers,
Steve


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]