第一个 QT Jambi 应用程序中存在多个运行时异常?

发布于 2024-12-09 06:25:08 字数 6854 浏览 3 评论 0原文

嗯......这是我的第一个 QT Jambi 应用程序,几乎只是尝试打开一个窗口。
这是我使用过的终端命令:

java -XstartOnFirstThread -cp qtjambi-4.6.3.jar:qtjambi-examples-4.6.3.jar:qtjambi-macosx-gcc-4.6.3.jar:。 图形用户界面

顺便说一句,我在 MacBook 上运行 Mac OS X Lion 64 位。
以下是上述命令的结果:

线程“main”中出现异常 java.lang.ExceptionInInitializerError at com.trolltech.qt.gui.QApplication.(QApplication.java:12) 位于 GUI.main(GUI.java:9) 引起:java.lang.RuntimeException:正在加载 库失败,到目前为止的进度:解压 .jar 文件: 'qtjambi-macosx-gcc-4.6.3.jar' 检查存档 'qtjambi-macosx-gcc-4.6.3.jar' - 缓存键='gcc-20100817-1815' - 将“libQtCore.4.dylib”添加到库映射中 - 库: name='lib/libQtCore.4.dylib', - 将“libQtGui.4.dylib”添加到库映射中 - 库: name='lib/libQtGui.4.dylib', - 将“libQtXml.4.dylib”添加到库映射中 - 库:名称='lib/libQtXml.4.dylib', - 将“libQtSql.4.dylib”添加到库映射中 - 库:名称='lib/libQtSql.4.dylib', - 将“libQtSvg.4.dylib”添加到库映射中 - 库: name='lib/libQtSvg.4.dylib', - 将“libQtHelp.4.dylib”添加到库映射中 - 库: name='lib/libQtHelp.4.dylib', - 将“libQtScript.4.dylib”添加到库映射中 - 库: name='lib/libQtScript.4.dylib', - 将“libQtScriptTools.4.dylib”添加到库映射中 - 库:名称='lib/libQtScriptTools.4.dylib', - 将“libQtMultimedia.4.dylib”添加到库映射中 - 库: name='lib/libQtMultimedia.4.dylib', - 将“libQtNetwork.4.dylib”添加到库映射中 - 库: name='lib/libQtNetwork.4.dylib', - 将“libQtOpenGL.4.dylib”添加到库映射中 - 库: name='lib/libQtOpenGL.4.dylib', - 将“libQtWebKit.4.dylib”添加到库映射中 - 库: name='lib/libQtWebKit.4.dylib', - 将“libQtXmlPatterns.4.dylib”添加到库映射中 - 库:名称='lib/libQtXmlPatterns.4.dylib', - 将“libphonon.4.dylib”添加到库映射中 - 库: name='lib/libphonon.4.dylib', - 将“libQtDBus.4.dylib”添加到库映射中 - 库:名称='lib/libQtDBus.4.dylib', - 库:name='plugins/phonon_backend/libphonon_qt7.dylib',从不加载 - 库:name='plugins/imageformats/libqjpeg.dylib',从不加载 - 库:name='plugins/imageformats/libqgif.dylib',从不加载 - 库:name='plugins/imageformats/libqmng.dylib',从不加载 - 库:name='plugins/imageformats/libqtiff.dylib',从不加载 - 库:name='plugins/imageformats/libqsvg.dylib',从不加载 - 库:name='plugins/iconengines/libqsvgicon.dylib',从不加载 - 库:name='plugins/codecs/libqcncodecs.dylib',从不加载 - 库:name='plugins/codecs/libqjpcodecs.dylib',从不加载 - 库:name='plugins/codecs/libqkrcodecs.dylib',从不加载 - 库:name='plugins/codecs/libqtwcodecs.dylib',从不加载 - 库:name='plugins/accessible/libqtaccessiblewidgets.dylib',从不加载 - 库:name='plugins/sqldrivers/libqsqlite.dylib',从不加载 - 将“libqtjambi.jnilib”添加到库映射中 - 库: name='lib/libqtjambi.jnilib', - 将“libcom_trolltech_qt_core.jnilib”添加到库映射中 - 库: name='lib/libcom_trolltech_qt_core.jnilib', - 将“libcom_trolltech_qt_gui.jnilib”添加到库映射中 - 库:name='lib/libcom_trolltech_qt_gui.jnilib',

  • 将“libcom_trolltech_qt_xml.jnilib”添加到库映射
  • 库:name='lib/libcom_trolltech_qt_xml.jnilib',
  • 将“libcom_trolltech_qt_sql.jnilib”添加到库映射
  • 库:name='lib/libcom_trolltech_qt_sql.jnilib',
  • 将“libcom_trolltech_qt_svg.jnilib”添加到库映射
  • 库:name='lib/libcom_trolltech_qt_svg.jnilib',
  • 将“libcom_trolltech_qt_help.jnilib”添加到库映射
  • 库:name='lib/libcom_trolltech_qt_help.jnilib',
  • 将“libcom_trolltech_qt_script.jnilib”添加到库映射
  • 库:name='lib/libcom_trolltech_qt_script.jnilib',
  • 将“libcom_trolltech_qt_scripttools.jnilib”添加到库映射
  • 库:name='lib/libcom_trolltech_qt_scripttools.jnilib',
  • 将“libcom_trolltech_qt_multimedia.jnilib”添加到库映射
  • 库:name='lib/libcom_trolltech_qt_multimedia.jnilib',
  • 将“libcom_trolltech_qt_network.jnilib”添加到库映射
  • 库:name='lib/libcom_trolltech_qt_network.jnilib',
  • 将“libcom_trolltech_qt_opengl.jnilib”添加到库映射
  • 库:name='lib/libcom_trolltech_qt_opengl.jnilib',
  • 将“libcom_trolltech_qt_phonon.jnilib”添加到库映射
  • 库:name='lib/libcom_trolltech_qt_phonon.jnilib',
  • 将“libcom_trolltech_qt_webkit.jnilib”添加到库映射
  • 库:name='lib/libcom_trolltech_qt_webkit.jnilib',
  • 将“libcom_trolltech_qt_xmlpatterns.jnilib”添加到库映射
  • 库:name='lib/libcom_trolltech_qt_xmlpatterns.jnilib',
  • 将“classes.nib”添加到库映射
  • 库:name='lib/Resources/qt_menu.nib/classes.nib',
  • 将“info.nib”添加到图书馆地图
  • 库:name='lib/Resources/qt_menu.nib/info.nib',
  • 将“keyedobjects.nib”添加到库地图
  • 库:name='lib/Resources/qt_menu.nib/keyedobjects.nib',
  • 插件路径='插件'
  • 使用缓存目录:'/var/folders/4p/s98fh7114t5g3y05fh59ctpm0000gn/T/QtJambi_b-dahse_x86_64_4.6.3_gcc-20100817-1815'
  • 缓存目录存在正在加载库:'libQtCore.4.dylib'...
  • 使用部署规范
  • 好的!正在加载库:'libqtjambi.jnilib'...
  • 使用部署规范
  • 好的!正在加载库:'libQtCore.4.dylib'...
  • 已加载,正在跳过...正在加载库:'libcom_trolltech_qt_core.jnilib'...
  • 使用部署规范
  • 好的!正在加载库:'libQtGui.4.dylib'...
  • 使用部署规范

    在 com.trolltech.qt.internal.NativeLibraryManager.loadNativeLibrary(NativeLibraryManager.java:431) 在 com.trolltech.qt.internal.NativeLibraryManager.loadQtLibrary(NativeLibraryManager.java:355) 在 com.trolltech.qt.Utilities.loadQtLibrary(Utilities.java:145) 处 com.trolltech.qt.Utilities.loadQtLibrary(Utilities.java:141)位于 com.trolltech.qt.gui.QtJambi_LibraryInitializer。(QtJambi_LibraryInitializer.java:7) ...另外 2 个 引起原因:java.lang.UnsatisfiedLinkError: /private/var/folders/4p/s98fh7114t5g3y05fh59ctpm0000gn/T/QtJambi_b-dahse_x86_64_4.6.3_gcc-20100817-1815/lib/libQtGui.4.dylib: 库未加载:/opt/local/lib/libpng12.0.dylib 引用自: /private/var/folders/4p/s98fh7114t5g3y05fh59ctpm0000gn/T/QtJambi_b-dahse_x86_64_4.6.3_gcc-20100817-1815/lib/libQtGui.4.dylib 原因:找不到图片

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

这是 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();
    }
}

这是 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();
    }
}

我现在非常困惑和不知所措,所以任何以前见过这个的人,请看一下并发布您可能有的任何输入。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

菊凝晚露 2024-12-16 06:25:08

您需要 /opt/local/lib/libpng12.0.dylib

指示此错误消息的部分引用如下:

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:未加载库: /opt/local/lib/libpng12.0.dylib

看起来构建和打包该版本 QtJambi 的人都在使用第 3 方 libpng 库。不幸的是我无法告诉你从哪里得到它(老实说它在 /opt/local 意味着它可能是自制的)。

您尝试一下 http://sourceforge.net/projects/qtjambi/files /4.7.0-beta1/ 如果这有助于或阻碍您的进步,请在此处发表评论。

(不幸的是)QtJambi 的各种版本存在已知的不一致之处,但我希望将来当我最终自己发布一些版本时,这些问题能够得到解决。

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.

您的好友蓝忘机已上羡 2024-12-16 06:25:08

编辑:我通过将 shell 脚本更改为以下内容来修复它:

#!/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

我已经下载了适用于 Mac OS X 的 Qt Jambi 4.7.0-beta1 32 位,当我运行 qtjambi.sh shell 脚本时,这是输出的内容:
不再需要!!

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!!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文