Sébastien Boisgérault wrote:

Hi all,

I'm searching for a way to make new Java classes , contained in a Jar file, available to Jython *at runtime* (the jar file is not yet known when jython is launched).

I thought for a moment that I had found a solution with:

>>> sys.packageManager.addJar("mypackage.jar", False)

... but it does not work as I expected: packages in the jar are available for import, but the classes are not actually loaded.

I thought that it was a bug, but it is not: the doc in PySystemState.java clearly states that "classes found are NOT made available to Jython by this call" and that this API is
made for embedded Java applications that deal with their own classloaders.

Does anyone knows how I could achieve my goal ?

Cheers,

SB

Errrr ... found it !

>>> sys.path.append("mypackage.jar")

makes the trick. Easy enough :)

SB