QtJambi 和 Jython
我正在努力让 QtJambi 和 Jython 能够很好地合作。这是我正在做的测试:
>jython -Dpython.path=./qtjambi-4.5.2_01.jar:./qtjambi-linux64-gcc-4.5.2_01.jar:.
Jython 2.2.1 on java1.6.0_18
Type "copyright", "credits" or "license" for more information.
>>> from com.trolltech.qt.gui import *
>>> dir(QApplication)
['aboutQt', 'aboutQtJambi', 'activeModalWidget', 'activePopupWidget', 'activeWindow', 'alert', 'allWidgets', 'beep', 'changeOverrideCursor', 'clipboard', 'closeAllWindows', 'colorSpec', 'commitData', 'commitDataRequest', 'cursorFlashTime', 'desktop', 'desktopSettingsAware', 'doubleClickInterval', 'exec', 'focusChanged', 'focusWidget', 'font', 'fontDatabaseChanged', 'fontMetrics', 'fromNativePointer', 'globalStrut', 'initialize', 'inputContext', 'instance', 'isEffectEnabled', 'isLeftToRight', 'isRightToLeft', 'isSessionRestored', 'keyboardInputDirection', 'keyboardInputInterval', 'keyboardInputLocale', 'keyboardModifiers', 'lastWindowClosed', 'layoutDirection', 'mouseButtons', 'notify', 'overrideCursor', 'palette', 'quitOnLastWindowClosed', 'restoreOverrideCursor', 'saveState', 'saveStateRequest', 'sessionId', 'sessionKey', 'sessionRestored', 'setActiveWindow', 'setColorSpec', 'setCursorFlashTime', 'setDesktopSettingsAware', 'setDoubleClickInterval', 'setEffectEnabled', 'setFont', 'setGlobalStrut', 'setGraphicsSystem', 'setInputContext', 'setKeyboardInputInterval', 'setLayoutDirection', 'setOverrideCursor', 'setPalette', 'setQuitOnLastWindowClosed', 'setStartDragDistance', 'setStartDragTime', 'setStyle', 'setStyleSheet', 'setWheelScrollLines', 'setWindowIcon', 'startDragDistance', 'startDragTime', 'style', 'styleSheet', 'syncX', 'topLevelAt', 'topLevelWidgets', 'type', 'wheelScrollLines', 'widgetAt', 'windowIcon']
>>> QApplication.initialize([])
Traceback (innermost last):
File "<console>", line 1, in ?
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError: Could not initialize class com.trolltech.qt.gui.QApplication
我尝试编译并运行一个简单的“Hello World”QtJambi 示例,它运行良好。
对我做错了什么有什么想法吗?
谢谢
I'm trying to get QtJambi and Jython to play nice together. Here's what I'm doing as a test:
>jython -Dpython.path=./qtjambi-4.5.2_01.jar:./qtjambi-linux64-gcc-4.5.2_01.jar:.
Jython 2.2.1 on java1.6.0_18
Type "copyright", "credits" or "license" for more information.
>>> from com.trolltech.qt.gui import *
>>> dir(QApplication)
['aboutQt', 'aboutQtJambi', 'activeModalWidget', 'activePopupWidget', 'activeWindow', 'alert', 'allWidgets', 'beep', 'changeOverrideCursor', 'clipboard', 'closeAllWindows', 'colorSpec', 'commitData', 'commitDataRequest', 'cursorFlashTime', 'desktop', 'desktopSettingsAware', 'doubleClickInterval', 'exec', 'focusChanged', 'focusWidget', 'font', 'fontDatabaseChanged', 'fontMetrics', 'fromNativePointer', 'globalStrut', 'initialize', 'inputContext', 'instance', 'isEffectEnabled', 'isLeftToRight', 'isRightToLeft', 'isSessionRestored', 'keyboardInputDirection', 'keyboardInputInterval', 'keyboardInputLocale', 'keyboardModifiers', 'lastWindowClosed', 'layoutDirection', 'mouseButtons', 'notify', 'overrideCursor', 'palette', 'quitOnLastWindowClosed', 'restoreOverrideCursor', 'saveState', 'saveStateRequest', 'sessionId', 'sessionKey', 'sessionRestored', 'setActiveWindow', 'setColorSpec', 'setCursorFlashTime', 'setDesktopSettingsAware', 'setDoubleClickInterval', 'setEffectEnabled', 'setFont', 'setGlobalStrut', 'setGraphicsSystem', 'setInputContext', 'setKeyboardInputInterval', 'setLayoutDirection', 'setOverrideCursor', 'setPalette', 'setQuitOnLastWindowClosed', 'setStartDragDistance', 'setStartDragTime', 'setStyle', 'setStyleSheet', 'setWheelScrollLines', 'setWindowIcon', 'startDragDistance', 'startDragTime', 'style', 'styleSheet', 'syncX', 'topLevelAt', 'topLevelWidgets', 'type', 'wheelScrollLines', 'widgetAt', 'windowIcon']
>>> QApplication.initialize([])
Traceback (innermost last):
File "<console>", line 1, in ?
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError: Could not initialize class com.trolltech.qt.gui.QApplication
I tried compiling and running a simple "Hello World" QtJambi example and it runs fine.
Any ideas of what I'm doing wrong?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
原生库!
我认为有一些共享库,也许 Java 虚拟机找不到它们。
不是有bin目录吗?它应该位于路径/而不是类路径上!
看看 如何将本机库添加到 java 库路径。
Native libs!
I think there are some shared-libs, and maybe the Java VM couldn't find them.
Isn't there a bin dir? It should be on the path /not the classpath!
Have a look at how-to-add-native-library-to-java-library-path.