问题描述
我是JavaFX的新手。尝试运行JavaFX应用程序时出现此错误
Exception in Application start method
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$1(LauncherImpl.java:182)
at java.lang.Thread.run(UnkNown Source)
Caused by: java.lang.AbstractMethodError: javafx.application.Application.start(Ljavafx/stage/Stage;)V
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$7(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294)
at com.sun.glass.ui.invokelaterdispatcher$Future.run(invokelaterdispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$4(WinApplication.java:186)
... 1 more
我的主班是main.mainpage
import javafx.application.Application;
import static javafx.application.Application.launch;
import javafx.application.Platform;
import javafx.event.EventHandler;
import javafx.stage.WindowEvent;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class mainpage extends Application {
public static Stage STAGE;
public static Scene SCENE;
@Override
public void start(Stage stage) throws Exception {
STAGE = stage;
Parent root = FXMLLoader.load(getClass().getResource("login.fxml"));
SCENE = new Scene(root);
STAGE.setScene(SCENE);
STAGE.show();
STAGE.setonCloseRequest(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent t) {
Platform.exit();
System.exit(0);
}
});
}
public static void main(String args[]) {
launch(args);
}
}
Proguard配置文件:
-injars '************************************************************.jar'
-outjars '************************************************************-obf.jar'
-libraryjars 'C:\Program Files\Java\jre1.8.0_251\lib\rt.jar'
-dontshrink
-obfuscationdictionary OBF.txt
-classobfuscationdictionary OBF.txt
-packageobfuscationdictionary OBF.txt
-dontnote
-dontwarn
-ignorewarnings
# Keep - Applications. Keep all application classes,along with their 'main'
# methods.
-keepclasseswithmembers public class com.javafx.main.Main,main.mainpage {
public static void main(java.lang.String[]);
}
# Rename FXML files together with related views
-adaptresourcefilenames **.fxml,**.png,**.css
-adaptresourcefilecontents **.fxml
-adaptclassstrings
# Save Meta-data for stack traces
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable
# Keep all annotations and Meta-data
-keepattributes *Annotation*,Signature,EnclosingMethod
# Keep names of fields marked with @FXML attribute
-keepclassmembers class * {
@javafx.fxml.FXML *;
}
# Also keep - Enumerations. Keep the special static methods that are required in
# enumeration classes.
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
# Also keep - Database drivers. Keep all implementations of java.sql.Driver.
-keep class * extends java.sql.Driver
# Keep names - Native method names. Keep all native class/method names.
-keepclasseswithmembers,includedescriptorclasses,allowshrinking class * {
native <methods>;
}
我使用exe4j制作exe文件。当我没有混淆地运行时,该应用程序正在运行。但混淆后无法正常工作。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)