Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't import FXML files with <?language javascript?> #794

Closed
jperedadnr opened this issue Nov 8, 2024 · 0 comments · Fixed by #795
Closed

Can't import FXML files with <?language javascript?> #794

jperedadnr opened this issue Nov 8, 2024 · 0 comments · Fixed by #795
Assignees
Labels
bug Something isn't working

Comments

@jperedadnr
Copy link
Collaborator

jperedadnr commented Nov 8, 2024

Since JavaFX 20, importing an FXML file with <?language javascript?> fails with:

java.io.IOException: javafx.fxml.LoadException: JavaScript script engine is disabled.
/hello-script.fxml

	at [email protected]/com.oracle.javafx.scenebuilder.kit.fxom.FXOMLoader.handleUnknownAndMissingCauses(FXOMLoader.java:119)
	at [email protected]/com.oracle.javafx.scenebuilder.kit.fxom.FXOMLoader.handleFxmlLoadingError(FXOMLoader.java:114)
	at [email protected]/com.oracle.javafx.scenebuilder.kit.fxom.FXOMLoader.load(FXOMLoader.java:106)
	at [email protected]/com.oracle.javafx.scenebuilder.kit.fxom.FXOMDocument.<init>(FXOMDocument.java:119)
	at [email protected]/com.oracle.javafx.scenebuilder.kit.editor.EditorController.updateFxomDocument(EditorController.java:2520)
	at [email protected]/com.oracle.javafx.scenebuilder.kit.editor.EditorController.setFxmlTextAndLocation(EditorController.java:713)
	at [email protected]/com.oracle.javafx.scenebuilder.app.DocumentWindowController.loadFromFile(DocumentWindowController.java:405)
	at [email protected]/com.oracle.javafx.scenebuilder.app.SceneBuilderApp.performOpenFiles(SceneBuilderApp.java:739)
	at [email protected]/com.oracle.javafx.scenebuilder.app.SceneBuilderApp.handleOpenFilesAction(SceneBuilderApp.java:538)
	at [email protected]/com.oracle.javafx.scenebuilder.app.welcomedialog.WelcomeDialogWindowController.openFilesAndHideStage(WelcomeDialogWindowController.java:315)
	at [email protected]/com.oracle.javafx.scenebuilder.app.welcomedialog.WelcomeDialogWindowController.attemptOpenExistingFiles(WelcomeDialogWindowController.java:308)
	at [email protected]/com.oracle.javafx.scenebuilder.app.welcomedialog.WelcomeDialogWindowController.handleOpen(WelcomeDialogWindowController.java:350)
	at [email protected]/com.oracle.javafx.scenebuilder.app.welcomedialog.WelcomeDialogWindowController.handleOpen(WelcomeDialogWindowController.java:291)
	at [email protected]/com.oracle.javafx.scenebuilder.app.welcomedialog.WelcomeDialogWindowController.fireOpenRecentProject(WelcomeDialogWindowController.java:239)
	at [email protected]/com.oracle.javafx.scenebuilder.app.welcomedialog.WelcomeDialogWindowController.lambda$loadAndPopulateRecentItemsInBackground$6(WelcomeDialogWindowController.java:200)
	at [email protected]/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
	at [email protected]/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:232)
	at [email protected]/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:189)
	at [email protected]/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
	at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
...
Caused by: javafx.fxml.LoadException: JavaScript script engine is disabled.
/hello-script.fxml

	at [email protected]/javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2723)
	at [email protected]/javafx.fxml.FXMLLoader.processLanguage(FXMLLoader.java:2810)
	at [email protected]/javafx.fxml.FXMLLoader.processProcessingInstruction(FXMLLoader.java:2776)
	at [email protected]/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2644)
	at [email protected]/javafx.fxml.FXMLLoader.load(FXMLLoader.java:2552)
	at [email protected]/com.oracle.javafx.scenebuilder.kit.fxom.FXOMLoader.load(FXOMLoader.java:104)
	... 67 more

As per https://openjfx.io/javadoc/23/javafx.fxml/javafx/fxml/doc-files/introduction_to_fxml.html#scripting
Scene Builder needs to run with
-Djavafx.allowjs=true

The same applies to the test that was modified in #619:

https://github.com/gluonhq/scenebuilder/pull/619/files#diff-fcff3bec73ef52f202e23cb21a1e0fd095b82bf66b6940fa5ed5b7165fc159bdL3

Reverting this change will work passing the same -Djavafx.allowjs=true to the surefire <argLine/>.

@jperedadnr jperedadnr added the bug Something isn't working label Nov 8, 2024
@jperedadnr jperedadnr self-assigned this Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant