From: Samuele P. <pe...@in...> - 2002-05-23 16:21:16
|
From: mark tompkins <saf...@ho...> > I am having a problem using java jars. > > The example is for jakarta-poi-1.5.0-FINAL-20020506.jar > > 1. I renamed jakarta-poi-1.5.0-FINAL-20020506.jar to poi.jar. > > 2. I modified registry, python path: > > python.path = .;g:\\poi\\build\\poi.jar\\org\\apache\\poi You gave too few information on your setting (classpath vs python.path content etc) but for sure the above should simply be python.path = .;g:\\poi\\build\\poi.jar I have not made my head around of the above produce but anyway not something useful. > as per warning during installation. the warning I imagine refer to Python module and packages access from jar, not to Java classes! > 3. Run Jython, and see what happens: > > C:\>jython > Jython 2.1 on java1.3.1 (JIT: null) > Type "copyright", "credits" or "license" for more information. > >>>import org.apache.poi as poi > >>>dir(poi) > ['__name__', 'dev', 'hpsf', 'hssf', 'poifs', 'util'] > >>>dir(poi.hssf) > ['__name__', 'dev', 'eventmodel', 'model', 'record', 'usermodel', 'util'] > >>>dir(poi.hssf.usermodel) > ['HSSFCell', 'HSSFCellStyle', 'HSSFColorConstants', 'HSSFDataFormat', > 'HSSFDateUtil', 'HSSFErrorConstants', 'HSSFFont', 'HSSFRow', 'HSSFSheet', > 'HSSFWorkbook', > '__name__'] > >>>x=poi.hssf.usermodel.HSSFWorkbook() > Traceback (innermost last): > File "<console>", line 1, in ? > AttributeError: java package 'org.apache.poi.hssf.usermodel' has no > attribute 'HSSFWorkbook' > >>> > > Why is this failing? Is there any way to fix it? I have encountered the > same problem with other jars. > > If I import jdk standard libs, everything works fine. > > ?? > > jython - so close, yet oh so far... ask again if the above does not solve the issue, in that case saying what is in classpath and what is your cwd could help too. regards. |