From: Noel R. <noe...@co...> - 2004-06-29 18:25:51
|
Your sample works for me (although I think that jdom.jar is already in my Java classpath). If jdom was not getting into the classpath at all than you'd likely get an error on the import line, so I'm not immediately sure why you are getting an error on line five (possibly a problem with JDOM versions?). One thing to try to diagnose is after the import statement some lines like this print org.jdom.__dict__ print org.jdom.input Those kinds of things will let you know if the package is being imported at all. Another thing to try would be to explicity put jdom.jar in the Java classpath with the environment variable (or the shell script that invokes jython). I don't think that's the problem you are having, but it can't hurt to try. Let me know how this goes... Noel Rappin Todd Moyer wrote: > I bought this book specifically for example 10-11 on page 176, which > attempts to use JDOM from Jython. Trimmed down, this example amounts > to calling a Java class from Jython: > > import sys > # point to your jdom.jar > sys.path.append ('...\\jdom.jar') > import org.jdom as jdom > builder = jdom.input.SAXBuilder() > > > However, when I run it I get: > > Traceback (innermost last): > File "jdomRecipe.py", line 5, in ? > AttributeError: java package 'org.jdom.input' has no attribute > 'SAXBuilder' > > This could just be a problem with my environment, but I can't figure > it out. Can anyone run this example? Any idea what might cause this > kind of error when calling Java classes? > > Thanks in advance. > > Todd Moyer > > > > ------------------------------------------------------- > This SF.Net email sponsored by Black Hat Briefings & Training. > Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital > self defense, top technical experts, no vendor pitches, unmatched > networking opportunities. Visit www.blackhat.com > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users > |