Issue
I've recently decided to take the plunge and start programming on Linux but the transition has been rough.
I'm currently trying to get a JavaFX program to run properly in InteliJ and I keep getting an error for Error: JavaFX runtime components are missing, and are required to run this application
I've tried several of the proposed fixes that you can find on Stack Overflow, namely this one and this one along with the walk-through on Gluon's own website but nothing that I have tried so far is working.
For a brief overview, I'm using... Java 17 (I don't remember why exactly anymore). JavaFX 19 through Maven InteliJ Idea Community & Fedora Workstation
I know for a fact that the code itself is good because it is the exact same code that I used on my windows machine and it worked fine. The only thing I've changed in regards to the code is the pom.xml file for Maven where I finally added JavaFX as a dependency while getting things ready for the new OS.
This is the pom.xml file. I'm not an expert with maven but everything does appear to be correct as best I can tell.
<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>LibraryDesktopApp</groupId>
<artifactId>LibraryDesktopApp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>LibraryDesktopAppProgram</name>
<description>This is the desktop program for the library software suite.</description>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-collections4 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.25</version>
</dependency>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>19</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>19</version>
</dependency>
<dependency>
<groupId>org.controlsfx</groupId>
<artifactId>controlsfx</artifactId>
<version>11.1.1</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
<plugin>
<!-- Build an executable JAR -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>com.mypackage.MyClass</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.8</version>
<executions>
<execution>
<!-- Default configuration for running with: mvn clean javafx:run -->
<id>default-cli</id>
<configuration>
<mainClass>LibraryDesktop/src.Main</mainClass>
<launcher>app</launcher>
<jlinkZipName>app</jlinkZipName>
<jlinkImageName>app</jlinkImageName>
<noManPages>true</noManPages>
<stripDebug>true</stripDebug>
<noHeaderFiles>true</noHeaderFiles>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
These are screenshots of various configuration screens.
Libraries
Modules
Configuration
I have tried running the program both with and without the VM arguments and neither worked.
Any help would be greatly appreciated! Thanks!
Solution
The entire project was converted over to a modular approach and I re-worked the pom.xml file too.
It was a bit of headache to get working but in addition to fixing my issue, the new setup is honestly much nicer than what I was dealing with before. On the off chance that someone else needs help with this same issue, I'm attaching a link to a fairly straightforward setup very similar to what I'm using. It does the job of explaining the process far better than I could.
Answered By - TeaDrinker Answer Checked By - Cary Denson (WPSolving Admin)