From: Benjamin C. <bc...@cs...> - 2001-03-09 23:00:29
|
thank you Jeff, that did work dandy. but now a different problem; perhaps you or someone can help me with it. i used jythonc to turn the class into a .class and put it in a directory that has some other .class examples for the system I'm using. I then used ant to build the examples.jar file, and that class was apparantly included (I say apparantly because the `sum` of examples.jar was different when i had the file in question in that directory). but the following happens: createAgent org.tagents.examples.AgentEx1 ===> works fine createAgent org.tagents.examples.AgentPy ====> gives the following: (a short note: I see that the code i'm using defines its own class loader; I understand that that could be the problem. I just thought I would check to see if I'm missing anything on the jython side before pursuing that route) java.lang.NoClassDefFoundError: org/tagents/examples/AgentPy (wrong name: AgentPy) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:496) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:11 7) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$300(URLClassLoader.java:69) at java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java:544) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:203) at java.lang.ClassLoader.loadClass(ClassLoader.java:325) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:380) at java.lang.ClassLoader.loadClass(ClassLoader.java:257) at java.lang.ClassLoader.findSystemClass(ClassLoader.java:630) at org.tagents.platform.AgentClassLoader.loadClass(AgentClassLoader.java :94) at java.lang.ClassLoader.loadClass(ClassLoader.java:257) Thanks! Ben On Fri, 9 Mar 2001, Jeff Davies wrote: > In jython, try the following: > > from org.tagents.agents import * > > That should do the trick. Of course, these classes still need to be in your > CLASSPATH for jython to find them. > > - Jeff Davies > > -----Original Message----- > From: Benjamin Collar [mailto:bc...@cs...] > Sent: Friday, March 09, 2001 11:24 AM > To: jyt...@li... > Subject: [Jython-users] super newbie question > > > hi there > > so I've got these packages, and I want to import classes from them. how do > i manage this? > > an example. the java source file Agent has this at the top: > > package org.tagents.examples; > > import org.tagents.agents.*; > > from jython, i tried "import org.tagents.agents.*," "import TAgents" (the > jar file name), "import TAgents.jar", and so on, but nothing works. so how > do I import this stuff? > > thanks > ben > > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > http://lists.sourceforge.net/lists/listinfo/jython-users > |