代码之家  ›  专栏  ›  技术社区  ›  Timothy Baldridge

Qtjambi和Jython

  •  2
  • Timothy Baldridge  · 技术社区  · 14 年前

    我想让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示例,它运行良好。

    你知道我做错了什么吗?

    谢谢

    1 回复  |  直到 14 年前
        1
  •  2
  •   Community Aniket Inge    7 年前

    本地LIBS!

    我认为有一些共享的LIBs,也许Java VM找不到它们。

    有垃圾桶吗?它应该在路径上/而不是类路径上!

    看一看 how-to-add-native-library-to-java-library-path