It's a jython bug... you NEED to have java classes in the classpath too (and not only in the sys.path). I'm sure it can be fixed (so, the only thing that's missing is someone with the need -- and the time -- to go and fix it).

Cheers,

Fabio

On 6/3/06, Cory Riddell <criddell@thetus.com> wrote:
I'm having a hard time figuring out how to load my jars on the fly and
reading through the archives I've found lots of similar questions but
nothing I've tried has worked. Here's the scenario-

I've downloaded and installed jython-2.1. I have a directory
C:\somewhere\lib with some jars in it. One of these jars has
com.something.MyClass.class in it. I don't have a CLASSPATH environment
variable or anything like that.

So, I start jython using the jython.bat file. Then:
>>> import sys
>>> sys.add_extdir("C:/somewhere/lib")
>>> import com.something
>>> x = com.something.MyClass()
Traceback (innermost last):
  File "<console>", line 1, in ?
AttributeError: java package 'com.something' has no attribute 'MyClass'

MyClass is public.I can also do this:
>>> dir(com.something)
['ISomething', 'MyClass', 'MyClass2', '__name__']

So jython knows about MyClass. Any idea what I need to do?

Thanks.


_______________________________________________
Jython-users mailing list
Jython-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users