问题
I've got an application written in Java 8 with ControlsFX 8.40.14.
I run the app under Java 9 (jdk-9.0.1 to be precise) and I got the following exception when the app tries to display SpreadsheetView component.
Exception in thread "JavaFX Application Thread" java.lang.NoSuchMethodError: javafx.scene.control.TableColumn.impl_setReorderable(Z)V
at org.controlsfx.control.spreadsheet.SpreadsheetView.getTableColumn(SpreadsheetView.java:2216)
at org.controlsfx.control.spreadsheet.SpreadsheetView.setGrid(SpreadsheetView.java:1162)
at org.controlsfx.control.spreadsheet.SpreadsheetView.<init>(SpreadsheetView.java:563)
at org.controlsfx.control.spreadsheet.SpreadsheetView.<init>(SpreadsheetView.java:475)
(...)javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
at javafx.base/javafx.event.Event.fireEvent(Event.java:198)
at javafx.graphics/javafx.scene.Scene$ClickGenerator.postProcess(Scene.java:3589)
at javafx.graphics/javafx.scene.Scene$ClickGenerator.access$8300(Scene.java:3517)
at javafx.graphics/javafx.scene.Scene$MouseHandler.process(Scene.java:3885)
at javafx.graphics/javafx.scene.Scene$MouseHandler.access$1300(Scene.java:3604)
at javafx.graphics/javafx.scene.Scene.processMouseEvent(Scene.java:1874)
at javafx.graphics/javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2613)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:397)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:434)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:433)
at javafx.graphics/com.sun.glass.ui.View.handleMouseEvent(View.java:556)
at javafx.graphics/com.sun.glass.ui.View.notifyMouse(View.java:942)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:175)
at java.base/java.lang.Thread.run(Thread.java:844)
The same exception occurs when the app is compiled with jdk1.8.144 and jdk-9.0.1
I cannot migrate to ControlsFX 9.0.0 as they don't support SpreadsheetView yet.
Any idea how to run such an application in Java 9?
回答1:
this may be late but a lot of controlsfx components do not work on JDK 9 because of couple of reasons, a lot of controlsfx components were not compatible with JDK 9,, thus version 9 was released to migrate from JDK 8 to 9,,, however, SpreadSheetView is removed...
check this issue: https://bitbucket.org/controlsfx/controlsfx/issues/780/controlsfx-should-support-java-9
as kerry said, used JDK 8
回答2:
Looking at the first line of the error:
Exception in thread "JavaFX Application Thread" java.lang.NoSuchMethodError: javafx.scene.control.TableColumn.impl_setReorderable(Z)V
The method TableColumn.imp_setReorderable()
I suspect is an internal and undocumented method? Possibly it has been removed in the JDK you are using (1.8.144).
I notice from the manifest for ControlsFX that version 8.40.14 was built with JDK1.8.0_131.
You could try obtaining JDK 1.8.0_131 and try running your application with that?
来源:https://stackoverflow.com/questions/47884742/using-ccontrolsfxs-spreadsheetview-in-java-9