From: SourceForge.net <no...@so...> - 2007-04-13 06:43:23
|
Bugs item #1692579, was opened at 2007-04-01 17:36 Message generated for change (Settings changed) made by cgroves You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112867&aid=1692579&group_id=12867 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Core >Group: targeted for 2.2beta2 Status: Open Resolution: None Priority: 5 Private: No Submitted By: Mr. Tines (mr_tines) Assigned to: Nobody/Anonymous (nobody) Summary: import java.awt fails in standalone mode if not bootstrapped Initial Comment: Jython 2.2b1, installed in standalone mode i.e. all of /Lib inside the jar, and cachedir being skipped. This affects more than just .awt in java; plus all of javax. The following code works with Jython launched from the jar in the standard install: import java.awt f = java.awt.Frame() f.title = "Hello AWT" f.visible = True but when run with Jython.jar from the standalone install the code gives C:\jython2.2b1-standalone>java -jar jython.jar Jython 2.2b1 on java1.6.0 (JIT: null) Type "copyright", "credits" or "license" for more information. >>> import java.awt Traceback (innermost last): File "", line 1, in ? ImportError: no module named awt >>> ^Z WORKROUND You need to nudge the system to do what caching would have done:- import sys sys.packageManager.makeJavaPackage("java.awt", "Window", None) import java.awt f = java.awt.Frame() f.title = "Hello AWT" f.visible = True NOT WORKROUND This does not work: try: import java.awt except ImportError: import sys sys.packageManager.makeJavaPackage("java.awt", "Window", None) import java.awt -- the second import fails as if the makeJavaPackage didn't stick (scoping effect?) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112867&aid=1692579&group_id=12867 |