我尝试使用 Gluon 库在 IntelliJ 中构建 JavaFx8 jar 文件。jar 已构建,但一旦我尝试访问需要 Gluon 魅力库的控制器,应用程序就会崩溃。我们正在使用:com.gluonhq:charm-down-desktop:1.0.0。
我正在使用项目中包含的 Gradle 构建进行构建。见附件。
这是堆栈跟踪:
Mar 31, 2016 12:22:29 PM TimeShiftGluon.Native.NativePlatformFactory getPlatform
SEVERE: null
java.lang.NoClassDefFoundError: com/gluonhq/charm/down/common/JavaFXPlatform
at TimeShiftGluon.Native.NativePlatformFactory.getSQliteDriver(NativePlatformFactory.java:48)
at TimeShiftGluon.Native.NativePlatformFactory.getPlatform(NativePlatformFactory.java:18)
at TimeShiftGluon.TimeShift_View.Main.setDeviceType(Main.java:748)
at TimeShiftGluon.TimeShift_View.Main.start(Main.java:364)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$163(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$176(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$174(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$175(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
Caused by: java.lang.ClassNotFoundException: com.gluonhq.charm.down.common.JavaFXPlatform
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
Exception in Application start method
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$156(LauncherImpl.java:182)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoClassDefFoundError: org/cometd/client/transport/ClientTransport
at TimeShiftGluon.TimeShift_View.Main.start(Main.java:366)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$163(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$176(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$174(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$175(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
Caused by: java.lang.ClassNotFoundException: org.cometd.client.transport.ClientTransport
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more
Thanks for your help.
这是我们的 build.gradle 文件:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.0.6'
}
}
apply plugin: 'org.javafxports.jfxmobile'
repositories {
mavenCentral()
jcenter()
maven {
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases/'
}
flatDir {
dirs 'libs'
}
}
mainClassName = 'TimeShiftGluon.TimeShift_View.Main'
ext.CHARM_DOWN_VERSION = "1.0.0"
dependencies{
compile "com.gluonhq:charm-down-common:$CHARM_DOWN_VERSION"
// CometD deps
compile 'org.eclipse.jetty.websocket:websocket-client:9.2.14.v20151106'
compile 'org.cometd.java:cometd-websocket-jetty:2.9.1'
compile 'org.cometd.java:cometd-java-websocket-jetty-client:3.0.3'
desktopRuntime "com.gluonhq:charm-down-desktop:$CHARM_DOWN_VERSION"
desktopRuntime 'org.xerial:sqlite-jdbc:3.8.11.2'
desktopRuntime 'org.cometd.java:cometd-java-client:3.0.9'
androidRuntime 'org.cometd.java:cometd-java-client:3.0.9'
androidRuntime "com.gluonhq:charm-down-android:$CHARM_DOWN_VERSION"
androidRuntime 'org.sqldroid:sqldroid:1.0.3'
iosRuntime "com.gluonhq:charm-down-ios:$CHARM_DOWN_VERSION"
}
jfxmobile {
android {
manifest = 'src/android/AndroidManifest.xml'
androidSdk = '/Applications/Old Apps/Android Studio.app/sdk'
}
ios {
forceLinkClasses = [ 'com.gluonhq.**.*' ]
infoPList = file('src/ios/Default-Info.plist')
}
}
task runAsTablet(dependsOn: jar, type: JavaExec, group: "Run") {
main = mainClassName
classpath = sourceSets.desktop.runtimeClasspath
jvmArgs "-Dcharm-desktop-form=tablet"
}