views:

27

answers:

1
+1  Q: 

QtJambi and Jython

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

+2  A: 

native libs !

i think there are some shared-libs, and maybe the java vm couldn't find them.

ist 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

Blauohr
Awesome! That worked! There's a /lib dir with QtJambi. Added -Djava.library.path=./lib/ and it works. Thanks!
Timothy Baldridge