0

I am attempting to use JavaFX on Linux Mint 22.2. I have followed the JavaFX getting started instructions for both 'Run HelloWorld Using JavaFX' and 'JavaFX and Visual Studio Code -> Non-modular from IDE'. I modified the getting started program to not use FXML. The program compiles and runs in VSCode, but with the following command line:

java --module-path /home/jim/Downloads/javafx-sdk-25/lib --add-modules javafx.controls --enable-native-access=javafx.graphics BuilderGUI.java 

I get:

Exception in thread "main" java.lang.UnsupportedOperationException: Unable to load glass GTK library.

Here is the program source code:

public class BuilderGUI extends Application { @Override public void start(Stage stage) throws Exception { StackPane pane = new StackPane(); pane.getChildren().add(new Label("Hello, FlexiShow Builder!")); Scene scene = new Scene(pane, 400, 300); stage.setScene(scene); stage.setTitle("FlexiShow Builder"); stage.show(); } public static void main(String[] args) { launch(args); } } 

and here is the contents of the launch.json file:

{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.1.0", "configurations": [ { "type": "java", "name": "Launch App", "request": "launch", "mainClass": "flexishowbuilder.BuilderGUI", "vmArgs": "--module-path /home/jim/Downloads/javafx-sdk-25/lib --add-modules javafx.controls --enable-native-access=javafx.graphics", } ] } 

Yes I have set the PATH_TO_FX environment variable. Otherwise the program would not compile either on the command line or in VSCode.

java --version 

gives:

openjdk 25 2025-09-16 OpenJDK Runtime Environment (build 25+36-snap) OpenJDK 64-Bit Server VM (build 25+36-snap, mixed mode, sharing)

and JavaFX version is 25.

How to I get rid of the exception so I can run the program at the command line?

4
  • Have you done a web search for that error? Your stuff here seems to be all about getting Java running, but guides online suggest you may be missing the GTK libraries. Commented Sep 22 at 17:23
  • @music2myear The glass GTK library is in the gtk library. I have checked and I have build-essential, libgtk-3-0 and libgtk-4.1 installed. I am not sure what else I would need. Commented Sep 22 at 21:06
  • It might be worth seeing whether you get more diagnostic information using the system properties suggested in InternalError running JavaFX 15 application on Windows Subsystem for Linux. Commented Oct 25 at 17:05
  • @DuncG Thanks for the response. I have switched to using Maven to build the project and I no longer have this problem. Commented Oct 26 at 12:56

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.