我决定在我的第一个 QT 项目中使用QTJambi。阅读 Wiki 后,我开始安装这个库。这是我的Qt\6.1.0\msvc2019_64\bin
文件夹的树:
C:\QT\6.1.0\MSVC2019_64\BIN
│ androiddeployqt.exe
│ androiddeployqt.pdb
│ androidtestrunner.exe
│ androidtestrunner.pdb
│ android_emulator_launcher.sh
│ assistant.exe
│ assistant.pdb
│ balsam.pdb
│ cmake_automoc_parser.exe
│ cmake_automoc_parser.pdb
│ d3dcompiler_47.dll
│ designer.exe
│ designer.pdb
│ dumpcpp.exe
│ dumpdoc.exe
│ ensure_pro_file.cmake
│ idc.exe
│ lconvert.exe
│ lconvert.pdb
│ licheck.exe
│ linguist.exe
│ linguist.pdb
│ lprodump.exe
│ lprodump.pdb
│ lrelease-pro.exe
│ lrelease-pro.pdb
│ lrelease.exe
│ lrelease.pdb
│ lupdate-pro.exe
│ lupdate-pro.pdb
│ lupdate.exe
│ lupdate.pdb
│ meshdebug.pdb
│ moc.exe
│ moc.pdb
│ opengl32sw.dll
│ pixeltool.exe
│ pixeltool.pdb
│ qdbus.exe
│ qdbus.pdb
│ qdbuscpp2xml.exe
│ qdbuscpp2xml.pdb
│ qdbusviewer.exe
│ qdbusviewer.pdb
│ qdbusxml2cpp.exe
│ qdbusxml2cpp.pdb
│ qdistancefieldgenerator.exe
│ qdistancefieldgenerator.pdb
│ qdoc.exe
│ qdoc.pdb
│ qhelpgenerator.exe
│ qhelpgenerator.pdb
│ qlalr.exe
│ qlalr.pdb
│ qmake.exe
│ qmake.pdb
│ qmake6.exe
│ qml.exe
│ qml.pdb
│ qmlcachegen.exe
│ qmlcachegen.pdb
│ qmleasing.exe
│ qmleasing.pdb
│ qmlformat.exe
│ qmlformat.pdb
│ qmlimportscanner.exe
│ qmlimportscanner.pdb
│ qmllint.exe
│ qmllint.pdb
│ qmlplugindump.exe
│ qmlplugindump.pdb
│ qmlpreview.exe
│ qmlpreview.pdb
│ qmlprofiler.exe
│ qmlprofiler.pdb
│ qmlscene.exe
│ qmlscene.pdb
│ qmltestrunner.exe
│ qmltestrunner.pdb
│ qmltime.exe
│ qmltime.pdb
│ qmltyperegistrar.exe
│ qmltyperegistrar.pdb
│ qsb.exe
│ qsb.pdb
│ qscxmlc.exe
│ qscxmlc.pdb
│ qt-cmake-private-install.cmake
│ qt-cmake-private.bat
│ qt-cmake-standalone-test.bat
│ qt-cmake.bat
│ qt-configure-module.bat
│ qt-internal-configure-tests.bat
│ Qt63DAnimation.dll
│ Qt63DAnimation.pdb
│ Qt63DAnimationd.dll
│ Qt63DAnimationd.pdb
│ Qt63DCore.dll
│ Qt63DCore.pdb
│ Qt63DCored.dll
│ Qt63DCored.pdb
│ Qt63DExtras.dll
│ Qt63DExtras.pdb
│ Qt63DExtrasd.dll
│ Qt63DExtrasd.pdb
│ Qt63DInput.dll
│ Qt63DInput.pdb
│ Qt63DInputd.dll
│ Qt63DInputd.pdb
│ Qt63DLogic.dll
│ Qt63DLogic.pdb
│ Qt63DLogicd.dll
│ Qt63DLogicd.pdb
│ Qt63DQuick.dll
│ Qt63DQuick.pdb
│ Qt63DQuickAnimation.dll
│ Qt63DQuickAnimation.pdb
│ Qt63DQuickAnimationd.dll
│ Qt63DQuickAnimationd.pdb
│ Qt63DQuickd.dll
│ Qt63DQuickd.pdb
│ Qt63DQuickExtras.dll
│ Qt63DQuickExtras.pdb
│ Qt63DQuickExtrasd.dll
│ Qt63DQuickExtrasd.pdb
│ Qt63DQuickInput.dll
│ Qt63DQuickInput.pdb
│ Qt63DQuickInputd.dll
│ Qt63DQuickInputd.pdb
│ Qt63DQuickRender.dll
│ Qt63DQuickRender.pdb
│ Qt63DQuickRenderd.dll
│ Qt63DQuickRenderd.pdb
│ Qt63DQuickScene2D.dll
│ Qt63DQuickScene2D.pdb
│ Qt63DQuickScene2Dd.dll
│ Qt63DQuickScene2Dd.pdb
│ Qt63DRender.dll
│ Qt63DRender.pdb
│ Qt63DRenderd.dll
│ Qt63DRenderd.pdb
│ Qt6Bodymovin.dll
│ Qt6Bodymovin.pdb
│ Qt6Bodymovind.dll
│ Qt6Bodymovind.pdb
│ Qt6Charts.dll
│ Qt6Charts.pdb
│ Qt6Chartsd.dll
│ Qt6Chartsd.pdb
│ Qt6Coap.pdb
│ Qt6Coapd.pdb
│ Qt6Concurrent.dll
│ Qt6Concurrent.pdb
│ Qt6Concurrentd.dll
│ Qt6Concurrentd.pdb
│ Qt6Core.dll
│ Qt6Core.pdb
│ Qt6Core5Compat.dll
│ Qt6Core5Compat.pdb
│ Qt6Core5Compatd.dll
│ Qt6Core5Compatd.pdb
│ Qt6Cored.dll
│ Qt6Cored.pdb
│ Qt6DataVisualization.dll
│ Qt6DataVisualization.pdb
│ Qt6DataVisualizationd.dll
│ Qt6DataVisualizationd.pdb
│ Qt6DBus.dll
│ Qt6DBus.pdb
│ Qt6DBusd.dll
│ Qt6DBusd.pdb
│ Qt6Designer.dll
│ Qt6Designer.pdb
│ Qt6DesignerComponents.dll
│ Qt6DesignerComponents.pdb
│ Qt6DesignerComponentsd.dll
│ Qt6DesignerComponentsd.pdb
│ Qt6Designerd.dll
│ Qt6Designerd.pdb
│ Qt6Gui.dll
│ Qt6Gui.pdb
│ Qt6Guid.dll
│ Qt6Guid.pdb
│ Qt6Help.dll
│ Qt6Help.pdb
│ Qt6Helpd.dll
│ Qt6Helpd.pdb
│ Qt6LabsAnimation.dll
│ Qt6LabsAnimation.pdb
│ Qt6LabsAnimationd.dll
│ Qt6LabsAnimationd.pdb
│ Qt6LabsFolderListModel.dll
│ Qt6LabsFolderListModel.pdb
│ Qt6LabsFolderListModeld.dll
│ Qt6LabsFolderListModeld.pdb
│ Qt6LabsQmlModels.dll
│ Qt6LabsQmlModels.pdb
│ Qt6LabsQmlModelsd.dll
│ Qt6LabsQmlModelsd.pdb
│ Qt6LabsSettings.dll
│ Qt6LabsSettings.pdb
│ Qt6LabsSettingsd.dll
│ Qt6LabsSettingsd.pdb
│ Qt6LabsSharedImage.dll
│ Qt6LabsSharedImage.pdb
│ Qt6LabsSharedImaged.dll
│ Qt6LabsSharedImaged.pdb
│ Qt6LabsWavefrontMesh.dll
│ Qt6LabsWavefrontMesh.pdb
│ Qt6LabsWavefrontMeshd.dll
│ Qt6LabsWavefrontMeshd.pdb
│ Qt6Mqtt.pdb
│ Qt6Mqttd.pdb
│ Qt6Network.dll
│ Qt6Network.pdb
│ Qt6NetworkAuth.dll
│ Qt6NetworkAuth.pdb
│ Qt6NetworkAuthd.dll
│ Qt6NetworkAuthd.pdb
│ Qt6Networkd.dll
│ Qt6Networkd.pdb
│ Qt6OpcUa.pdb
│ Qt6OpcUad.pdb
│ Qt6OpenGL.dll
│ Qt6OpenGL.pdb
│ Qt6OpenGLd.dll
│ Qt6OpenGLd.pdb
│ Qt6OpenGLWidgets.dll
│ Qt6OpenGLWidgets.pdb
│ Qt6OpenGLWidgetsd.dll
│ Qt6OpenGLWidgetsd.pdb
│ Qt6PrintSupport.dll
│ Qt6PrintSupport.pdb
│ Qt6PrintSupportd.dll
│ Qt6PrintSupportd.pdb
│ Qt6Qml.dll
│ Qt6Qml.pdb
│ Qt6Qmld.dll
│ Qt6Qmld.pdb
│ Qt6QmlLocalStorage.dll
│ Qt6QmlLocalStorage.pdb
│ Qt6QmlLocalStoraged.dll
│ Qt6QmlLocalStoraged.pdb
│ Qt6QmlModels.dll
│ Qt6QmlModels.pdb
│ Qt6QmlModelsd.dll
│ Qt6QmlModelsd.pdb
│ Qt6QmlWorkerScript.dll
│ Qt6QmlWorkerScript.pdb
│ Qt6QmlWorkerScriptd.dll
│ Qt6QmlWorkerScriptd.pdb
│ Qt6Quick.dll
│ Qt6Quick.pdb
│ Qt6Quick3D.pdb
│ Qt6Quick3DAssetImport.pdb
│ Qt6Quick3DAssetImportd.pdb
│ Qt6Quick3Dd.pdb
│ Qt6Quick3DIblBaker.pdb
│ Qt6Quick3DIblBakerd.pdb
│ Qt6Quick3DParticles.pdb
│ Qt6Quick3DParticlesd.pdb
│ Qt6Quick3DRuntimeRender.pdb
│ Qt6Quick3DRuntimeRenderd.pdb
│ Qt6Quick3DUtils.pdb
│ Qt6Quick3DUtilsd.pdb
│ Qt6QuickControls2.dll
│ Qt6QuickControls2.pdb
│ Qt6QuickControls2d.dll
│ Qt6QuickControls2d.pdb
│ Qt6QuickControls2Impl.dll
│ Qt6QuickControls2Impl.pdb
│ Qt6QuickControls2Impld.dll
│ Qt6QuickControls2Impld.pdb
│ Qt6Quickd.dll
│ Qt6Quickd.pdb
│ Qt6QuickLayouts.dll
│ Qt6QuickLayouts.pdb
│ Qt6QuickLayoutsd.dll
│ Qt6QuickLayoutsd.pdb
│ Qt6QuickParticles.dll
│ Qt6QuickParticles.pdb
│ Qt6QuickParticlesd.dll
│ Qt6QuickParticlesd.pdb
│ Qt6QuickShapes.dll
│ Qt6QuickShapes.pdb
│ Qt6QuickShapesd.dll
│ Qt6QuickShapesd.pdb
│ Qt6QuickTemplates2.dll
│ Qt6QuickTemplates2.pdb
│ Qt6QuickTemplates2d.dll
│ Qt6QuickTemplates2d.pdb
│ Qt6QuickTest.dll
│ Qt6QuickTest.pdb
│ Qt6QuickTestd.dll
│ Qt6QuickTestd.pdb
│ Qt6QuickWidgets.dll
│ Qt6QuickWidgets.pdb
│ Qt6QuickWidgetsd.dll
│ Qt6QuickWidgetsd.pdb
│ Qt6Scxml.dll
│ Qt6Scxml.pdb
│ Qt6Scxmld.dll
│ Qt6Scxmld.pdb
│ Qt6ScxmlQml.dll
│ Qt6ScxmlQml.pdb
│ Qt6ScxmlQmld.dll
│ Qt6ScxmlQmld.pdb
│ Qt6ShaderTools.dll
│ Qt6ShaderTools.pdb
│ Qt6ShaderToolsd.dll
│ Qt6ShaderToolsd.pdb
│ Qt6Sql.dll
│ Qt6Sql.pdb
│ Qt6Sqld.dll
│ Qt6Sqld.pdb
│ Qt6StateMachine.dll
│ Qt6StateMachine.pdb
│ Qt6StateMachined.dll
│ Qt6StateMachined.pdb
│ Qt6StateMachineQml.dll
│ Qt6StateMachineQml.pdb
│ Qt6StateMachineQmld.dll
│ Qt6StateMachineQmld.pdb
│ Qt6Svg.dll
│ Qt6Svg.pdb
│ Qt6Svgd.dll
│ Qt6Svgd.pdb
│ Qt6SvgWidgets.dll
│ Qt6SvgWidgets.pdb
│ Qt6SvgWidgetsd.dll
│ Qt6SvgWidgetsd.pdb
│ Qt6Test.dll
│ Qt6Test.pdb
│ Qt6Testd.dll
│ Qt6Testd.pdb
│ Qt6UiTools.dll
│ Qt6UiTools.pdb
│ Qt6UiToolsd.dll
│ Qt6UiToolsd.pdb
│ Qt6VirtualKeyboard.dll
│ Qt6VirtualKeyboard.pdb
│ Qt6VirtualKeyboardd.dll
│ Qt6VirtualKeyboardd.pdb
│ Qt6Widgets.dll
│ Qt6Widgets.pdb
│ Qt6Widgetsd.dll
│ Qt6Widgetsd.pdb
│ Qt6Xml.dll
│ Qt6Xml.pdb
│ Qt6Xmld.dll
│ Qt6Xmld.pdb
│ qtattributionsscanner.exe
│ qtattributionsscanner.pdb
│ qtdiag.exe
│ qtdiag.pdb
│ qtdiag6.exe
│ QtJambi3DAnimation6.dll
│ QtJambi3DCore6.dll
│ QtJambi3DLogic6.dll
│ QtJambi3DQuick6.dll
│ QtJambi3DQuickScene2D6.dll
│ QtJambi3DRender6.dll
│ QtJambi6.dll
│ QtJambiCharts6.dll
│ QtJambiConcurrent6.dll
│ QtJambiCore6.dll
│ QtJambiDataVisualization6.dll
│ QtJambiDBus6.dll
│ QtJambiDesigner6.dll
│ QtJambiGui6.dll
│ QtJambiHelp6.dll
│ QtJambiNetwork6.dll
│ QtJambiNetworkAuth6.dll
│ QtJambiOpenGL6.dll
│ QtJambiOpenGLWidgets6.dll
│ QtJambiPrintSupport6.dll
│ QtJambiQml6.dll
│ QtJambiQuick3D6.dll
│ QtJambiQuick6.dll
│ QtJambiQuickControls26.dll
│ QtJambiQuickWidgets6.dll
│ QtJambiScxml6.dll
│ QtJambiSql6.dll
│ QtJambiStateMachine6.dll
│ QtJambiSvg6.dll
│ QtJambiSvgWidgets6.dll
│ QtJambiTest6.dll
│ QtJambiUiTools6.dll
│ QtJambiVirtualKeyboard6.dll
│ QtJambiWidgets6.dll
│ QtJambiXml6.dll
│ qtpaths.exe
│ qtpaths.pdb
│ qtplugininfo.exe
│ qtplugininfo.pdb
│ qtquickcontrols2implplugin.dll
│ qtquickcontrols2implplugind.dll
│ qvkgen.exe
│ qvkgen.pdb
│ rcc.exe
│ rcc.pdb
│ shadergen.pdb
│ syncqt.pl
│ testcon.exe
│ tracegen.exe
│ tracegen.pdb
│ uic.exe
│ uic.pdb
│ windeployqt.exe
│ windeployqt.pdb
我使用运行时参数作为类路径
-Djava.library.path=C:\Qt\jBin\bin;C:\Qt\6.1.0\msvc2019_64\bin
jBin 文件夹包含.jar
QT 的所有文件。这是我的代码:
public static void main(String[] args) {
QtUtilities.initializePackage("io.qt.network");
QtUtilities.initializePackage("io.qt.quick");
QtUtilities.loadQtLibrary("QuickShapes");
QtUtilities.loadQtLibrary("QuickTemplates2");
QtUtilities.loadQtLibrary("QuickParticles");
QtUtilities.loadQtLibrary("QuickControls2");
QCoreApplication.setAttribute(Qt.ApplicationAttribute.AA_EnableHighDpiScaling);
QGuiApplication qGuiApplication = QGuiApplication.initialize(args);
QQuickView view = new QQuickView();
view.engine().addImportPath("StorageScanner/imports");
view.setSource(QUrl.fromLocalFile("StorageScanner/StorageScanner.qml"));
if (!view.errors().isEmpty()){
view.errors().forEach(qQmlError -> {
System.err.println(qQmlError.toString());
});
throw new RuntimeException("Resource load failed");
}
view.show();
QGuiApplication.exec();
}
但我总是得到一个错误:
file:///.../QtTest/StorageScanner/StorageScanner.qml:9:5: Type Screen01 unavailable
file:///.../QtTest/StorageScanner/Screen01.ui.qml:2:1: Cannot load library C:\Qt\6.1.0\msvc2019_64\qml\QtQuick\Controls\impl\qtquickcontrols2implplugin.dll: The specified module could not be found.
file:///.../QtTest/StorageScanner/Screen01.ui.qml: Failed to load dependencies for module "QtQuick.Controls" version 2.15
DLL 位于指定路径。我该如何解决?谢谢指教!