AppManager выдает java.lang.ClassNotFoundException: com.gluonhq.attach.display.DisplayService при запускеJAVA

Программисты JAVA общаются здесь
Ответить Пред. темаСлед. тема
Anonymous
 AppManager выдает java.lang.ClassNotFoundException: com.gluonhq.attach.display.DisplayService при запуске

Сообщение Anonymous »

Пример проекта представляет собой почти копию образцов.
Используется следующий основной класс:

Код: Выделить всё

import javafx.application.Application;
import javafx.stage.Stage;

import com.gluonhq.charm.glisten.application.AppManager;

public class MainApp extends Application {

private AppManager app = AppManager.initialize();

@Override
public void start(Stage stage) {
app.start(stage); // line 14
}

public static void main(String[] args) {
launch(args);
}
}
информация о модуле:

Код: Выделить всё

module hellofx {
requires javafx.base;
requires javafx.graphics;

requires com.gluonhq.charm.glisten;

exports org.openjfx;
}
build.gradle:

Код: Выделить всё

plugins {
id "application"
id "org.openjfx.javafxplugin" version "+"
id "org.beryx.jlink" version "+"
id "com.gluonhq.gluonfx-gradle-plugin" version "+"
}

dependencies {
implementation "com.gluonhq:charm-glisten:6.2.3"
}

javafx {
version = "23"
modules = [ "javafx.controls" ]
}

gluonfx {
//  target = "ios"  // uncomment to deploy on iOS
//  target = "android"  // uncomment to deploy on Android

attachConfig {
version = "4.0.21"
services "display", "lifecycle", "statusbar", "storage"
}
}

application {
mainClass = "org.openjfx.MainApp"
mainModule = "hellofx"
}

jlink {
options = ["--strip-debug", "--compress", "2", "--no-header-files", "--no-man-pages"]
launcher {
name = "hellofx"
}
}
Проект отлично компилируется как в Gradle, так и в IDE. Выполнение gradlew run или запуск из IDE приводит к ошибке времени выполнения:

Код: Выделить всё

Exception in Application start method
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:118)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at javafx.graphics@23/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:464)
at javafx.graphics@23/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:364)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1147)
Caused by: java.lang.RuntimeException: Exception in Application start method
at javafx.graphics@23/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:893)
at javafx.graphics@23/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196)
at java.base/java.lang.Thread.run(Thread.java:1570)
Caused by: java.lang.NoClassDefFoundError: com/gluonhq/attach/display/DisplayService
at com.gluonhq.charm.glisten@6.2.3/com.gluonhq.impl.charm.glisten.util.DeviceSettings.hasNotch(DeviceSettings.java:27)
at com.gluonhq.charm.glisten@6.2.3/com.gluonhq.impl.charm.glisten.util.DeviceSettings.setup(DeviceSettings.java:45)
at com.gluonhq.charm.glisten@6.2.3/com.gluonhq.impl.charm.glisten.util.DeviceSettings.dedicatedSetup(DeviceSettings.java:38)
at com.gluonhq.charm.glisten@6.2.3/com.gluonhq.charm.glisten.control.AppBar.(AppBar.java:127)
at com.gluonhq.charm.glisten@6.2.3/com.gluonhq.charm.glisten.application.AppManager.start(AppManager.java:258)
at hellofx/org.openjfx.MainApp.start(MainApp.java:14)
at javafx.graphics@23/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:839)
at javafx.graphics@23/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:483)
at javafx.graphics@23/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:456)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
at javafx.graphics@23/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:455)
at javafx.graphics@23/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at javafx.graphics@23/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics@23/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:184)
... 1 more
Caused by: java.lang.ClassNotFoundException: com.gluonhq.attach.display.DisplayService
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
... 15 more
Exception running application org.openjfx.MainApp

Код: Выделить всё

app.start(stage)
— это строка, которая требует наличия класса в строке. При использовании обычного приложения без AppManager этой проблемы нет.

Подробнее здесь: https://stackoverflow.com/questions/790 ... -display-d
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «JAVA»