我安装了JDK8u20
并尝试使用其中的ControlsFX
库来运行我的程序。
这应该可以正常工作,但如果我从controlsFX调用一个方法,我会得到以下异常
方式
private void showError(final String msg) {
Platform.runLater(new Runnable() {
@Override
public void run() {
Dialogs.create().title("Achtung").message(msg).showError();
}
});
}
异常
java.lang.NoSuchMethodError: com.sun.javafx.scene.traversal.TraversalEngine.<init>(Ljavafx/scene/Parent;Z)V
at org.controlsfx.control.ButtonBar$2.<init>(ButtonBar.java:412)
at org.controlsfx.control.ButtonBar.<init>(ButtonBar.java:412)
at org.controlsfx.control.ButtonBar.<init>(ButtonBar.java:355)
at org.controlsfx.dialog.Dialog.createButtonPanel(Dialog.java:1034)
at org.controlsfx.dialog.Dialog.createCenterPanel(Dialog.java:1029)
at org.controlsfx.dialog.Dialog.buildDialogContent(Dialog.java:950)
at org.controlsfx.dialog.Dialog.show(Dialog.java:320)
at org.controlsfx.dialog.Dialogs.showSimpleContentDialog(Dialogs.java:1106)
at org.controlsfx.dialog.Dialogs.showError(Dialogs.java:555)
at ch.berufsbildungscenter.notiztool.gui.control.LoginController$3.run(LoginController.java:93)
at com.sun.javafx.application.PlatformImpl.lambda$null$164(Unknown Source)
at com.sun.javafx.application.PlatformImpl$$Lambda$48/1171794308.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$165(Unknown Source)
at com.sun.javafx.application.PlatformImpl$$Lambda$47/1875594551.run(Unknown Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$141(Unknown Source)
at com.sun.glass.ui.win.WinApplication$$Lambda$38/994750745.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
答案 0 :(得分:5)
为将来面临同样问题的人添加答案:
ControlsFX 8.0.6
已在两个单独的版本中发布
如果你想知道为什么? here is an explanation to it
如果您使用的是JDK8,请使用ControlsFX 8.0.6
如果您使用的是JDK8_20或更高版本,请使用ControlsFX 8.0.6_20