Multiple runtime exceptions in first QT Jambi application?

1.6k views Asked by At

Hmmmm..... this is my first QT Jambi application and pretty much just an attempt to bring up a window.
This is the terminal command I've used:

java -XstartOnFirstThread -cp qtjambi-4.6.3.jar:qtjambi-examples-4.6.3.jar:qtjambi-macosx-gcc-4.6.3.jar:. GUI

And by the way, I'm running Mac OS X Lion 64-bit on a MacBook.
Here's the outcome of the above command:

Exception in thread "main" java.lang.ExceptionInInitializerError at com.trolltech.qt.gui.QApplication.(QApplication.java:12) at GUI.main(GUI.java:9) Caused by: java.lang.RuntimeException: Loading library failed, progress so far: Unpacking .jar file: 'qtjambi-macosx-gcc-4.6.3.jar' Checking Archive 'qtjambi-macosx-gcc-4.6.3.jar' - cache key='gcc-20100817-1815' - adding 'libQtCore.4.dylib' to library map - library: name='lib/libQtCore.4.dylib', - adding 'libQtGui.4.dylib' to library map - library: name='lib/libQtGui.4.dylib', - adding 'libQtXml.4.dylib' to library map - library: name='lib/libQtXml.4.dylib', - adding 'libQtSql.4.dylib' to library map - library: name='lib/libQtSql.4.dylib', - adding 'libQtSvg.4.dylib' to library map - library: name='lib/libQtSvg.4.dylib', - adding 'libQtHelp.4.dylib' to library map - library: name='lib/libQtHelp.4.dylib', - adding 'libQtScript.4.dylib' to library map - library: name='lib/libQtScript.4.dylib', - adding 'libQtScriptTools.4.dylib' to library map - library: name='lib/libQtScriptTools.4.dylib', - adding 'libQtMultimedia.4.dylib' to library map - library: name='lib/libQtMultimedia.4.dylib', - adding 'libQtNetwork.4.dylib' to library map - library: name='lib/libQtNetwork.4.dylib', - adding 'libQtOpenGL.4.dylib' to library map - library: name='lib/libQtOpenGL.4.dylib', - adding 'libQtWebKit.4.dylib' to library map - library: name='lib/libQtWebKit.4.dylib', - adding 'libQtXmlPatterns.4.dylib' to library map - library: name='lib/libQtXmlPatterns.4.dylib', - adding 'libphonon.4.dylib' to library map - library: name='lib/libphonon.4.dylib', - adding 'libQtDBus.4.dylib' to library map - library: name='lib/libQtDBus.4.dylib', - library: name='plugins/phonon_backend/libphonon_qt7.dylib', never load - library: name='plugins/imageformats/libqjpeg.dylib', never load - library: name='plugins/imageformats/libqgif.dylib', never load - library: name='plugins/imageformats/libqmng.dylib', never load - library: name='plugins/imageformats/libqtiff.dylib', never load - library: name='plugins/imageformats/libqsvg.dylib', never load - library: name='plugins/iconengines/libqsvgicon.dylib', never load - library: name='plugins/codecs/libqcncodecs.dylib', never load - library: name='plugins/codecs/libqjpcodecs.dylib', never load - library: name='plugins/codecs/libqkrcodecs.dylib', never load - library: name='plugins/codecs/libqtwcodecs.dylib', never load - library: name='plugins/accessible/libqtaccessiblewidgets.dylib', never load - library: name='plugins/sqldrivers/libqsqlite.dylib', never load - adding 'libqtjambi.jnilib' to library map - library: name='lib/libqtjambi.jnilib', - adding 'libcom_trolltech_qt_core.jnilib' to library map - library: name='lib/libcom_trolltech_qt_core.jnilib', - adding 'libcom_trolltech_qt_gui.jnilib' to library map - library: name='lib/libcom_trolltech_qt_gui.jnilib',

  • adding 'libcom_trolltech_qt_xml.jnilib' to library map
  • library: name='lib/libcom_trolltech_qt_xml.jnilib',
  • adding 'libcom_trolltech_qt_sql.jnilib' to library map
  • library: name='lib/libcom_trolltech_qt_sql.jnilib',
  • adding 'libcom_trolltech_qt_svg.jnilib' to library map
  • library: name='lib/libcom_trolltech_qt_svg.jnilib',
  • adding 'libcom_trolltech_qt_help.jnilib' to library map
  • library: name='lib/libcom_trolltech_qt_help.jnilib',
  • adding 'libcom_trolltech_qt_script.jnilib' to library map
  • library: name='lib/libcom_trolltech_qt_script.jnilib',
  • adding 'libcom_trolltech_qt_scripttools.jnilib' to library map
  • library: name='lib/libcom_trolltech_qt_scripttools.jnilib',
  • adding 'libcom_trolltech_qt_multimedia.jnilib' to library map
  • library: name='lib/libcom_trolltech_qt_multimedia.jnilib',
  • adding 'libcom_trolltech_qt_network.jnilib' to library map
  • library: name='lib/libcom_trolltech_qt_network.jnilib',
  • adding 'libcom_trolltech_qt_opengl.jnilib' to library map
  • library: name='lib/libcom_trolltech_qt_opengl.jnilib',
  • adding 'libcom_trolltech_qt_phonon.jnilib' to library map
  • library: name='lib/libcom_trolltech_qt_phonon.jnilib',
  • adding 'libcom_trolltech_qt_webkit.jnilib' to library map
  • library: name='lib/libcom_trolltech_qt_webkit.jnilib',
  • adding 'libcom_trolltech_qt_xmlpatterns.jnilib' to library map
  • library: name='lib/libcom_trolltech_qt_xmlpatterns.jnilib',
  • adding 'classes.nib' to library map
  • library: name='lib/Resources/qt_menu.nib/classes.nib',
  • adding 'info.nib' to library map
  • library: name='lib/Resources/qt_menu.nib/info.nib',
  • adding 'keyedobjects.nib' to library map
  • library: name='lib/Resources/qt_menu.nib/keyedobjects.nib',
  • plugin path='plugins'
  • using cache directory: '/var/folders/4p/s98fh7114t5g3y05fh59ctpm0000gn/T/QtJambi_b-dahse_x86_64_4.6.3_gcc-20100817-1815'
  • cache directory exists Loading library: 'libQtCore.4.dylib'...
  • using deployment spec
  • ok! Loading library: 'libqtjambi.jnilib'...
  • using deployment spec
  • ok! Loading library: 'libQtCore.4.dylib'...
  • already loaded, skipping... Loading library: 'libcom_trolltech_qt_core.jnilib'...
  • using deployment spec
  • ok! Loading library: 'libQtGui.4.dylib'...
  • using deployment spec

    at com.trolltech.qt.internal.NativeLibraryManager.loadNativeLibrary(NativeLibraryManager.java:431) at com.trolltech.qt.internal.NativeLibraryManager.loadQtLibrary(NativeLibraryManager.java:355) at com.trolltech.qt.Utilities.loadQtLibrary(Utilities.java:145) at com.trolltech.qt.Utilities.loadQtLibrary(Utilities.java:141) at com.trolltech.qt.gui.QtJambi_LibraryInitializer.(QtJambi_LibraryInitializer.java:7) ... 2 more Caused by: java.lang.UnsatisfiedLinkError: /private/var/folders/4p/s98fh7114t5g3y05fh59ctpm0000gn/T/QtJambi_b-dahse_x86_64_4.6.3_gcc-20100817-1815/lib/libQtGui.4.dylib: Library not loaded: /opt/local/lib/libpng12.0.dylib Referenced from: /private/var/folders/4p/s98fh7114t5g3y05fh59ctpm0000gn/T/QtJambi_b-dahse_x86_64_4.6.3_gcc-20100817-1815/lib/libQtGui.4.dylib Reason: image not found

    at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1827) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1703) at java.lang.Runtime.load0(Runtime.java:770) at java.lang.Runtime.load(Runtime.java:758) at com.trolltech.qt.internal.NativeLibraryManager.loadLibrary_helper(NativeLibraryManager.java:458) at com.trolltech.qt.internal.NativeLibraryManager.loadNativeLibrary(NativeLibraryManager.java:426) ... 6 more

Here's the source code of GUI.java:

import gui.ViewWindow;
import com.trolltech.qt.gui.QApplication;

public class GUI {

    public static ViewWindow viewWindow;

    public static void main(String[] args) {
        QApplication.initialize(args);
        viewWindow = new ViewWindow();
        QApplication.exec();
    }
}

And here's ViewWindow.java:

package gui;

import com.trolltech.qt.gui.QWidget;

public class ViewWindow extends QWidget {

    public ViewWindow() {
        setWindowTitle("Level editor for Ben's Great Escape");

        resize(1000, 600);
        move(0, 0);
        show();
    }
}

I'm very confused and overwhelmed right now, so anyone who have seen this before, please take a look and post any input you might have.

2

There are 2 answers

0
Darryl Miles On BEST ANSWER

You need /opt/local/lib/libpng12.0.dylib

The part of the error message indicating this is quoted below:

Caused by: java.lang.UnsatisfiedLinkError: /private/var/folders/4p/s98fh7114t5g3y05fh59ctpm0000gn/T/QtJambi_b-dahse_x86_64_4.6.3_gcc-20100817-1815/lib/libQtGui.4.dylib: Library not loaded: /opt/local/lib/libpng12.0.dylib

.

It looks like whoever built and packaged up that version of QtJambi was using a 3rd party libpng library. Unfortunately I can not tell you where to get that from (and to be honest it being in /opt/local mean it was probably home-built).

How about you try with http://sourceforge.net/projects/qtjambi/files/4.7.0-beta1/ please comment back here if this help or hinders your progress.

There are (unfortunately) known inconsistencies with various builds of QtJambi but I hope these things are ironed out in the future when I finally get to publishing some releases myself.

1
Benjamin On

EDIT: I fixed it by changing the shell script to this:

#!/bin/sh

me=$(dirname $0)

if [ -e binpatch ];
then
    ./binpatch
    export DYLD_LIBRARY_PATH=$me/lib
    export QT_PLUGIN_PATH=$me/plugins
fi

if ! java -version 2>&1 | grep -q "1\.[5-9]"
then
    echo "Qt Jambi requires Java version 1.5.0 or higher to be preinstalled"
    echo "to work. If Java is installed then make sure that the 'java' executable"
    echo "is available in the PATH environment."
else
    for lib in $(ls qtjambi*.jar); do
    CP=$lib:$CP
    done
    java -d32 -XstartOnFirstThread -cp $CP com.trolltech.launcher.Launcher
fi

I've downloaded Qt Jambi 4.7.0-beta1 32-bit for Mac OS X, and when I run the qtjambi.sh shell script, this is what is outputted: NO LONGER NEEDED!!