From: Updike, C. <Cla...@jh...> - 2003-11-24 15:29:55
|
This works in jython 2.1: >>> import sys >>> sys.path.insert(0,r'C:\lib\JDOM\jdom-b8\build\jdom.jar') >>> from org.jdom.input import SAXBuilder >>> SAXBuilder <jclass org.jdom.input.SAXBuilder at 2336044> >>> -Clark -----Original Message----- From: Chai Ang [mailto:ca...@re...] Sent: Sunday, November 23, 2003 6:45 PM To: jyt...@li... Subject: [Jython-users] adding jars dynamically (again) Hi there all, I know this has been discussed before but despite that I am still having difficulty getting this to work. http://aspn.activestate.com/ASPN/Mail/Message/Jython-users/1636130 I am using Jython 2.2a0 on java1.4.2 (JIT: null). What I am trying to do is use jdom, the xml parser (www.jdom.org). However, I am trying not to have the jdom.jar file in my classpath. I want to be able to add the jar file dynamically. Note that it works when I've the jar file in my classpath. Anyway, I have tried the following. #-- cut here import sys sys.add_extdir( "d:\\java" ) # where my jdom.jar is in subdir d:\java\ from org.jdom.input import SAXBuilder builder = SAXBuilder( 0 ) #-- end here However, I get this error >>> ImportError: cannot import name SAXBuilder Some more info I tried >>> import org.jdom.input >>> >>> dir( org.jdom.input) ['BuilderErrorHandler', 'DOMBuilder', 'DefaultJDOMFactory', 'JDOMFactory', 'JDOM ParseException', 'SAXBuilder', 'SAXHandler', '__name__'] So the name is there, yes? What am I doing wrong? Many thanks in advance, Chai ###################################################################### Attention: The information in this electronic mail is privileged and confidential, intended only for use of the individual or entity named. If you are not the intended recipient, any dissemination, copying or use of the information is strictly prohibited. If you have received this transmission in error, please delete it immediately from your system and inform us via mailto op...@re... This e-mail has been scanned and cleared by MailMarshal ###################################################################### ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ Jython-users mailing list Jyt...@li... https://lists.sourceforge.net/lists/listinfo/jython-users |