Home  >  Article  >  Java  >  Why am I getting an `IllegalAccessError` when creating a Label in JavaFX 11?

Why am I getting an `IllegalAccessError` when creating a Label in JavaFX 11?

Barbara Streisand
Barbara StreisandOriginal
2024-11-03 06:31:30491browse

Why am I getting an `IllegalAccessError` when creating a Label in JavaFX 11?

JavaFX 11: IllegalAccessError when creating Label

Question:

An IllegalAccessError occurs when trying to add a Label to a StackPane in a JavaFX application.

Answer:

JavaFX 11 is not included with the JDK, so the JavaFX SDK must be added as a library and configured with the following VM options:

`

<br>-p <path-to-javafx-sdk>/lib --add-modules javafx.base,javafx.graphics,javafx.controls<br>
`

The above is the detailed content of Why am I getting an `IllegalAccessError` when creating a Label in JavaFX 11?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn