Javafx, Itext7, maven dependencies and setting up the proper module-info.java file

121 views Asked by At

Beginner here; I am creating a project with JavaFX and Itext7 and I don't understand how maven dependencies work. I am constructing this project on vsCode and this is how I have my dependencies set up in my pom.xml file.

<dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>kernel</artifactId>
        <version>${itext.version}</version>
    </dependency>
    <!-- always needed -->
    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>io</artifactId>
        <version>${itext.version}</version>
    </dependency>
    <!-- always needed -->
    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>layout</artifactId>
        <version>${itext.version}</version>
    </dependency>
    <!-- only needed for forms -->
    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>forms</artifactId>
        <version>${itext.version}</version>
    </dependency>
    <!-- only needed for PDF/A -->
    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>pdfa</artifactId>
        <version>${itext.version}</version>
    </dependency>
    <!-- only needed for digital signatures -->
    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>sign</artifactId>
        <version>${itext.version}</version>
    </dependency>
    <!-- only needed for barcodes -->
    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>barcodes</artifactId>
        <version>${itext.version}</version>
    </dependency>

Then in my module-info.java file, I was able to get the desired imports by using the following code,

requires transitive kernel;
requires transitive io;
requires transitive forms;
requires transitive layout;
requires transitive barcodes;
requires transitive pdfa;
requires transitive sign;

For each one of these I am getting the same error -> Name of automatic module 'kernel' is unstable, it is derived from the module's file name.

This is happening for each of these lines - ie: Name of automatic module 'io'... etc.

Now I created a jar file of the project and it runs when I run it from terminal but it doesn't work when I click the jar icon from my desktop. After running from terminal I get the following message, WARNING: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @5a65309b'.

How can I resolve these issues and get the project to work when the jar file is clicked from desktop?

0

There are 0 answers