Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

JavaFX not available/not working at runtime for NB modules

Aperta
#9,491 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
java
Ambito
desktop

Direzione di ricerca

Inizia con il progetto di riproduzione nel percorso collegato for_nb_classloading e con la configurazione della dipendenza org-netbeans-libs-javafx. Analizza come vengono esposte le librerie JavaFX in modules/ext quando le dipendenze dei moduli usano provided scope, usando lo stack trace Toolkit not initialized come punto del malfunzionamento. Il lavoro è completato quando il modulo esegue JavaFX con la configurazione delle dipendenze documentata, oppure quando l’utilizzo richiesto è documentato chiaramente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

JavaFX kind:bug needs:triage Platform
Apache NetBeans version

Apache NetBeans 30

What happened

Goal: build a NB module which uses JavaFX for the UI.

Understood solution:

  1. add a dependency to org-netbeans-libs-javafx in the module pom
  2. add the needed dependencies for JavaFX modules (controls, fxml, etc.) in the module pom with scope provided - NB should provide the classes
  3. build the module
  4. install JavaFX Library for XXX (Linux/Windows/Mac)
  5. install the module

What works:
The module compile and installs, but when it tries to run JavaFX, it runs into exception

SEVERE [global]
java.lang.IllegalStateException: Toolkit not initialized
	at com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:436)
	at com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:431)
	at javafx.application.Platform.runLater(Platform.java:168)
	at ste.netbeans.restart.RestartIDEAction.lambda$actionPerformed$2(RestartIDEAction.java:83)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
	at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:136)
[catch] at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

I would expect the module to pick the libraries in ext, which are available:

[ste userdir] =)o ls -la modules/ext/
total 54204
drwxrwxr-x 2 ste ste     4096 Jul  7 23:14 .
drwxrwxr-x 3 ste ste     4096 Jul  7 23:15 ..
-rw-rw-r-- 1 ste ste   753864 Jul  7 23:14 javafx-base-21.0.9-linux.jar
-rw-rw-r-- 1 ste ste  2585211 Jul  7 23:14 javafx-controls-21.0.9-linux.jar
-rw-rw-r-- 1 ste ste  4697444 Jul  7 23:14 javafx-graphics-21.0.9-linux.jar
-rw-rw-r-- 1 ste ste  1507586 Jul  7 23:14 javafx-media-21.0.9-linux.jar
-rw-rw-r-- 1 ste ste    89705 Jul  7 23:14 javafx-swing-21.0.9-linux.jar
-rw-rw-r-- 1 ste ste 45844181 Jul  7 23:14 javafx-web-21.0.9-linux.jar

It seems instead these libraries are not available unless declared as compile scope.

Language / Project Type / NetBeans Component

No response

How to reproduce

See https://github.com/stefanofornari/nb-ide-restart/tree/ste/test/for_nb_classloading

Did this work correctly in an earlier version?

No / Don't know

Operating System

Linux

JDK

both OpenJDK 21 and Zulu 21.50

Apache NetBeans packaging

Apache NetBeans binary zip

Anything else

I could not find any useful and updated documentation at least on how JavaFX IMplementation for XXX is supposed to work and how to use it either to build a JavaFX application or a module using JavaFX

Are you willing to submit a pull request?

No

Lingua principale
Java
Stelle
3.1k
Fork
939
Merge medio
5g 3h
PR unite (30g)
22

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/netbeans

Tutte le issue di apache/netbeans

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.