4

I've been stuck on this error now for a few days. I've googled the heck out it and tried at least a dozen different proposed solutions in various forms...

My project runs fine, UNTIL I attempt to use a specific library called MonacoFX, which, according to the GitHub page, was developed in Java 13 (I'm using Java 16.0.1 for this project). The documentation for the library is straight forward, you instantiate the library like you do with most libraries, then you simply use it. However, as soon as I attempt to instantiate it, I get this error at runtime:

Exception in thread "JavaFX Application Thread"
java.lang.IllegalAccessError: superclass access check failed:
  class com.sun.javafx.sg.prism.web.NGWebView (in unnamed module @0x1937acaf)
        cannot access class com.sun.javafx.sg.prism.NGGroup (in module javafx.graphics) 
        because module javafx.graphics does not export 
        com.sun.javafx.sg.prism to unnamed module @0x1937acaf
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1012)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:862)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:760)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:681)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
at eu.mihosoft.monacofx@0.0.7/eu.mihosoft.monacofx.MonacoFX.<init>(MonacoFX.java:49)
at com.dustinredmond.newgistfx/com.dustinredmond.newgistfx.data.GistFile.<init>(GistFile.java:28)
at com.dustinredmond.newgistfx/com.dustinredmond.newgistfx.data.GistObject.process(GistObject.java:113)
at com.dustinredmond.newgistfx/com.dustinredmond.newgistfx.data.GistObject.<init>(GistObject.java:27)
at com.dustinredmond.newgistfx/com.dustinredmond.newgistfx.github.GitHubApi.setGitHub(GitHubApi.java:31)
at com.dustinredmond.newgistfx/com.dustinredmond.newgistfx.ui.LoginWindowController.authenticate(LoginWindowController.java:39)
at com.dustinredmond.newgistfx/com.dustinredmond.newgistfx.ui.LoginWindow.lambda$new$1(LoginWindow.java:57)
at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
at javafx.base/javafx.event.Event.fireEvent(Event.java:198)
at javafx.graphics/javafx.scene.Node.fireEvent(Node.java:8889)
at javafx.controls/javafx.scene.control.Button.fire(Button.java:203)
at javafx.controls/com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:208)
at javafx.controls/com.sun.javafx.scene.control.inputmap.InputMap.handle(InputMap.java:274)
at javafx.base/com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
at javafx.base/javafx.event.Event.fireEvent(Event.java:198)
at javafx.graphics/javafx.scene.Scene$MouseHandler.process(Scene.java:3856)
at javafx.graphics/javafx.scene.Scene.processMouseEvent(Scene.java:1851)
at javafx.graphics/javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2584)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:409)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:299)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:447)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:412)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:446)
at javafx.graphics/com.sun.glass.ui.View.handleMouseEvent(View.java:556)
at javafx.graphics/com.sun.glass.ui.View.notifyMouse(View.java:942)
at javafx.graphics/com.sun.glass.ui.mac.MacView.notifyMouse(MacView.java:127)

It looks like the developer of the library hasn't been active on that GitHub page for quite some time now, though I did create an issue nonetheless.

I've tried the solutions where they say to use the command line argument, which mine looks like this:

--module-path /Library/Java/JavaVirtualMachines/jdk-16.0.1.jdk/Contents/Home/lib
--add-modules javafx.controls,javafx.fxml,javafx.web,javafx.graphics,javafx.media

I've tried using a separate Launcher class:

public class Launcher {
    public static void main(String[] args) {
        Main.main(args);
    }
}

And nothing is working, the error happens at the moment I try to instantiate the library.

So I'm seeking any insight or knowledge that anyone might have on this problem ... OR ... if anyone knows of a good JavaFX library that provides language-aware code style editing, I'd be keenly interested in that.

Here is my POM file:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.dustinredmond</groupId>
    <artifactId>NewGistFX</artifactId>
    <version>1.0-SNAPSHOT</version>
    <name>NewGistFX</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <junit.version>5.7.1</junit.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
            <version>16</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-fxml</artifactId>
            <version>16</version>
        </dependency>
        <dependency>
            <groupId>org.controlsfx</groupId>
            <artifactId>controlsfx</artifactId>
            <version>11.1.0</version>
        </dependency>
        <dependency>
            <groupId>net.synedra</groupId>
            <artifactId>validatorfx</artifactId>
            <version>0.1.13</version>
            <exclusions>
                <exclusion>
                    <groupId>org.openjfx</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.mylyn.github</groupId>
            <artifactId>org.eclipse.egit.github.core</artifactId>
            <version>2.1.5</version>
        </dependency>
        <dependency>
            <groupId>com.fifesoft</groupId>
            <artifactId>rsyntaxtextarea</artifactId>
            <version>3.1.3</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.dustinredmond.fxtrayicon</groupId>
            <artifactId>FXTrayIcon</artifactId>
            <version>3.1.1</version>
        </dependency>
        <dependency>
            <groupId>org.kohsuke</groupId>
            <artifactId>github-api</artifactId>
            <version>1.133</version>
        </dependency>
        <dependency>
            <groupId>com.squareup.okio</groupId>
            <artifactId>okio</artifactId>
            <version>2.10.0</version>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-stdlib-jdk8</artifactId>
            <version>1.5.31</version>
        </dependency>
        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>okhttp</artifactId>
            <version>4.9.2</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-crypto</artifactId>
            <version>5.5.3</version>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.15</version>
        </dependency>
        <dependency>
            <groupId>eu.mihosoft.monacofx</groupId>
            <artifactId>monacofx</artifactId>
            <version>0.0.7</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>16</source>
                    <target>16</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.openjfx</groupId>
                <artifactId>javafx-maven-plugin</artifactId>
                <version>0.0.7</version>
                <executions>
                    <execution>
                        <!-- Default configuration for running with: mvn clean javafx:run -->
                        <id>default-cli</id>
                        <configuration>
                            <mainClass>com.dustinredmond.newgistfx/com.dustinredmond.newgistfx.Main</mainClass>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

And here is my module-info file:

module com.dustinredmond.newgistfx {
    requires javafx.controls;
    requires javafx.fxml;

    requires org.controlsfx.controls;
    requires validatorfx;
    requires javafx.graphics;

    requires java.prefs;
    requires org.apache.commons.codec;
    requires github.api;
    requires org.apache.commons.io;
    requires rsyntaxtextarea;
    requires java.desktop;
    requires FXTrayIcon;
    requires org.eclipse.egit.github.core;
    requires okhttp3;
    requires eu.mihosoft.monacofx;


    exports com.dustinredmond.newgistfx.ui;


    opens com.dustinredmond.newgistfx to javafx.base;
    opens com.dustinredmond.newgistfx.data to javafx.base;
}

I am grateful for any assistance that anyone can offer.

Thank you

jewelsea
  • 150,031
  • 14
  • 366
  • 406
Michael Sims
  • 2,360
  • 1
  • 16
  • 29

1 Answers1

5

How to debug dependencies

Include the maven dependency plugin in your project.

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>3.2.0</version>
        </plugin>
    </plugins>
</build>

Run mvn dependency:tree on your project.

[INFO] --- maven-dependency-plugin:3.2.0:tree (default-cli) @ NewGistFX ---
[INFO] com.dustinredmond:NewGistFX:jar:1.0-SNAPSHOT
[INFO] +- org.openjfx:javafx-controls:jar:16:compile
[INFO] |  +- org.openjfx:javafx-controls:jar:win:16:compile
[INFO] |  \- org.openjfx:javafx-graphics:jar:16:compile
[INFO] |     \- org.openjfx:javafx-graphics:jar:win:16:compile
[INFO] +- org.openjfx:javafx-fxml:jar:16:compile
[INFO] |  \- org.openjfx:javafx-fxml:jar:win:16:compile
[INFO] +- org.controlsfx:controlsfx:jar:11.1.0:compile
[INFO] +- net.synedra:validatorfx:jar:0.1.13:compile
[INFO] +- org.junit.jupiter:junit-jupiter-api:jar:5.7.1:test
[INFO] |  +- org.apiguardian:apiguardian-api:jar:1.1.0:test
[INFO] |  +- org.opentest4j:opentest4j:jar:1.2.0:test
[INFO] |  \- org.junit.platform:junit-platform-commons:jar:1.7.1:test
[INFO] +- org.junit.jupiter:junit-jupiter-engine:jar:5.7.1:test
[INFO] |  \- org.junit.platform:junit-platform-engine:jar:1.7.1:test
[INFO] +- org.eclipse.mylyn.github:org.eclipse.egit.github.core:jar:2.1.5:compile
[INFO] |  \- com.google.code.gson:gson:jar:2.2.2:compile
[INFO] +- com.fifesoft:rsyntaxtextarea:jar:3.1.3:compile
[INFO] +- junit:junit:jar:4.13.1:test
[INFO] |  \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- com.dustinredmond.fxtrayicon:FXTrayIcon:jar:3.1.1:compile
[INFO] +- org.kohsuke:github-api:jar:1.133:compile
[INFO] |  +- org.apache.commons:commons-lang3:jar:3.9:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.12.5:compile
[INFO] |  |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.12.5:compile
[INFO] |  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.12.5:compile
[INFO] |  \- commons-io:commons-io:jar:2.8.0:compile
[INFO] +- com.squareup.okio:okio:jar:2.10.0:compile
[INFO] |  +- org.jetbrains.kotlin:kotlin-stdlib:jar:1.4.20:compile
[INFO] |  |  \- org.jetbrains:annotations:jar:13.0:compile
[INFO] |  \- org.jetbrains.kotlin:kotlin-stdlib-common:jar:1.4.20:compile
[INFO] +- org.jetbrains.kotlin:kotlin-stdlib-jdk8:jar:1.5.31:compile
[INFO] |  \- org.jetbrains.kotlin:kotlin-stdlib-jdk7:jar:1.5.31:compile
[INFO] +- com.squareup.okhttp3:okhttp:jar:4.9.2:compile
[INFO] +- org.springframework.security:spring-security-crypto:jar:5.5.3:compile
[INFO] +- commons-codec:commons-codec:jar:1.15:compile
[INFO] \- eu.mihosoft.monacofx:monacofx:jar:0.0.7:compile
[INFO]    +- org.openjfx:javafx-base:jar:12.0.1:compile
[INFO]    |  \- org.openjfx:javafx-base:jar:win:12.0.1:compile
[INFO]    +- org.openjfx:javafx-web:jar:12.0.1:runtime
[INFO]    |  \- org.openjfx:javafx-web:jar:win:12.0.1:runtime
[INFO]    \- org.openjfx:javafx-media:jar:12.0.1:runtime
[INFO]       \- org.openjfx:javafx-media:jar:win:12.0.1:runtime

Issues with your project and how to fix them

Note that your project is using javafx-controls/javafx-graphics 16 and monacofx is depending on javafx-base/javafx-web/javafx-media 12.0.1.

JavaFX does not support mixing JavaFX module versions, so it breaks.

Do not do this.

Fix the versioning in your pom.xml so that all JavaFX modules are the same version.

Also, you are defining a module-info.java file, you need to add the required dependencies to your module-info for this to work. So fix them (see my example below, note it requires javafx.web and eu.mihosoft.monacofx).

Don't do the launcher hack to create a Launcher.java file. JavaFX is not architected to run that way and it is not supported.

If you are going to run from the command line, you need to specify the module path to all of the modules you are using, not just the JDK modules. In fact you don't need the JDK modules added explicitly to the module path, they will be added automatically as they are implicitly part of the jdk image you are working with.

You are using Maven, so all of the required non-jdk dependencies to be placed on the module path are in your Maven repository, you can get them from there. If you use an IDE like Idea and have managed to get the app to run in the IDE (without using the JavaFX maven plugin to run it), then look at the command line the IDE used to run the app, specifically the module path (or -p) option, and copy everything from there and use the same thing when trying to run from the command prompt.

OR, create a proper runtime image (google it) using jlink/jdeps and perhaps jpackage, and use that to execute your app.

MonacoFX doesn't have a module-info.java file, so you won't be able to use jlink to include it until the developer creates a new package with a module-info.java file. You could file a feature request for the project for them to do that if you wish.

And maybe also another feature request for them to not require JavaFX 12 packages as dependencies

For example, in a Maven build those dependencies in the Monaco project could be marked as provided, for instance and the documentation for the Monaco project could note that in order for it work certain JavaFX modules must be on the module path.

Sample application

monaco

This is just using the sample app from MonacoFX

package com.example.monacotest;

import eu.mihosoft.monacofx.MonacoFX;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

public class MonacoTestApp extends Application {

    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) throws Exception {
        // create a new monaco editor node
        MonacoFX monacoFX = new MonacoFX();
        StackPane root = new StackPane(monacoFX);

        // set initial text
        monacoFX.getEditor().getDocument().setText(
                """
                #include <stdio.h>
                int main() {
                   // printf() displays the string inside quotation
                   printf("Hello, World!");
                   return 0;
                }
                """
        );

        // use a predefined language like 'c'
        monacoFX.getEditor().setCurrentLanguage("c");
        monacoFX.getEditor().setCurrentTheme("vs-dark");

        // the usual scene & stage setup
        Scene scene = new Scene(root, 800,600);
        primaryStage.setTitle("MonacoFX Demo (running on JDK " + System.getProperty("java.version") + ")");
        primaryStage.setScene(scene);
        primaryStage.show();
    }
}

module-info.java

I only require the stuff to make Monaco work for the test. You can add the rest of the things you need into your project.

You must require javafx.web, or you will get the error shown in your question.

module com.example.monacotest {
    requires javafx.web;
    requires eu.mihosoft.monacofx;

    exports com.example.monacotest;
}

pom.xml

We exclude the JavaFX dependencies of monacofx, and define all of the necessary dependencies for JavaFX directly in our project, with the correct versions.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.example.monacotest</groupId>
    <artifactId>MonacoTestApp</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>17</java.version>
        <javafx.version>17.0.1</javafx.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-web</artifactId>
            <version>${javafx.version}</version>
        </dependency>
        <dependency>
            <groupId>eu.mihosoft.monacofx</groupId>
            <artifactId>monacofx</artifactId>
            <version>0.0.7</version>
            <exclusions>
                <exclusion>
                    <groupId>org.openjfx</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>3.2.0</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

Correct dependency tree:

[INFO] --- maven-dependency-plugin:3.2.0:tree (default-cli) @ MonacoTestApp ---
[INFO] com.example.monacotest:MonacoTestApp:jar:1.0-SNAPSHOT
[INFO] +- org.openjfx:javafx-web:jar:17.0.1:compile
[INFO] |  +- org.openjfx:javafx-web:jar:win:17.0.1:compile
[INFO] |  +- org.openjfx:javafx-controls:jar:17.0.1:compile
[INFO] |  |  +- org.openjfx:javafx-controls:jar:win:17.0.1:compile
[INFO] |  |  \- org.openjfx:javafx-graphics:jar:17.0.1:compile
[INFO] |  |     +- org.openjfx:javafx-graphics:jar:win:17.0.1:compile
[INFO] |  |     \- org.openjfx:javafx-base:jar:17.0.1:compile
[INFO] |  |        \- org.openjfx:javafx-base:jar:win:17.0.1:compile
[INFO] |  \- org.openjfx:javafx-media:jar:17.0.1:compile
[INFO] |     \- org.openjfx:javafx-media:jar:win:17.0.1:compile
[INFO] \- eu.mihosoft.monacofx:monacofx:jar:0.0.7:compile
jewelsea
  • 150,031
  • 14
  • 366
  • 406
  • no screenshots of plain text please ;) – kleopatra Oct 30 '21 at 23:21
  • I need to find a good resource to educate myself on modular programming with Java. I've been using Java8 almost exclusively until just recently and this modular change has really thrown me fo a loop. – Michael Sims Oct 31 '21 at 00:35
  • @MichaelSims This is a good introductory article for modules: [Understanding Java 9 Modules](https://www.oracle.com/corporate/features/understanding-java-9-modules.html). – Slaw Oct 31 '21 at 04:15
  • Also, I made the following changes to my project according to your answer, and this is what fixed it: I changed the SDK to 17.0.1, I changed the POM file to use the ${javafx.version} on those applicable dependencies, I added requires javafx.web to in module-info and I completely deleted all command line arguments from my run / Edit Configurations in IntelliJ and now the project runs perfectly. I will read the article you commented and educate myself on what is a mystery to me at the moment concerning modular coding and newer Java versions. THANK YOU very much for such a detailed response. – Michael Sims Oct 31 '21 at 14:49
  • Well, I read the link you commented on concerning the explanation of modules, and I find myself quite perplexed over many things. I think perhaps what is most confusing for me, is that I don't even know what questions to ask at the moment in trying to understand this new way of writing code in Java. I think there are probably many fundamental concepts - perhaps in OOP in general or maybe just Java - that I simply don't know and maybe I have not needed to know because of the way in which IDEs like IntelliJ mask the need to know - at least that is my assumption at this point. – Michael Sims Oct 31 '21 at 15:11
  • For thoroughness and for anyone who is reading this post in the future, I also deleted the Launcher class I had created as was suggested in this answer. – Michael Sims Oct 31 '21 at 15:15
  • What if I get this error, but I do not have a pom.xml or a module-info.java file? Intellij says it is a modular project, but I guess it is not maven? – Neal May 04 '22 at 16:24
  • 1
    @Neal there are other build modes (modular and non-modular), build tools (gradle, maven, ide, etc), different setups for ides etc. Describing them all is not the purpose of this answer. The answer is just to targeted at the question which is modular and maven. Note that there are different module types, e.g. maven modules, Java platform modules, ide modules, etc that may or be at all related. This answer refers to Java platform modules. – jewelsea May 04 '22 at 17:15
  • More comprehensive, though necessarily not complete coverage, of various build options for modularity, ide and build tool combination can be found at openjfx.io getting started documentation. The easiest way to get started is to use the idea new JavaFX project tool. – jewelsea May 04 '22 at 17:15