Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Errors after updating Java 23 and JavaFX 22 to Java 24 and JavaFX 24

Tags:

java

javafx

After updating to JavaFX 24 and Java 24, I got the following warnings:

WARNING: package sun.misc not in java.base WARNING: A terminally deprecated method in sun.misc.Unsafe has been called WARNING: sun.misc.Unsafe::allocateMemory has been called by com.sun.marlin.OffHeapArray (file:/C:/Program%20Files/Java/javafx-sdk-24/lib/javafx.graphics.jar)

WARNING: Please consider reporting this to the maintainers of class com.sun.marlin.OffHeapArray

WARNING: sun.misc.Unsafe::allocateMemory will be removed in a future release

The main application runs just fine, but it just throws this warning

like image 794
Bruce Avatar asked Oct 26 '25 20:10

Bruce


1 Answers

JavaFX 25

Fixed in JavaFX 25 (requires JDK23+). Released 2025-09-15.

So, after upgrading, the flag shown below will not be needed.

See JDK-8345121.

JavaFX 24

See the Release Notes for JavaFX 24, which says:

Known Issues

JavaFX Warning Printed for Use of Terminally Deprecated Methods in sun.misc.Unsafe

Running a JavaFX application on JDK 24 will produce a warning the first time any UI Control or complex shape is rendered:

WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
...
WARNING: sun.misc.Unsafe::allocateMemory will be removed in a future release

To disable this warning, pass --sun-misc-unsafe-memory-access=allow to java on the command line. For example:

java --sun-misc-unsafe-memory-access=allow
like image 72
DuncG Avatar answered Oct 29 '25 10:10

DuncG



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!