Issue
My pom includes the itext7-core artifact.
<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>18-ea+7</version>
.....
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itext7-core</artifactId>
<version>7.2.0</version>
<type>pom</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.8</version>
<configuration>
<stripDebug>true</stripDebug>
<compress>2</compress>
<noHeaderFiles>true</noHeaderFiles>
<noManPages>true</noManPages>
<launcher>parallel</launcher>
<jlinkImageName>parallel</jlinkImageName>
<jlinkZipName>parallel</jlinkZipName>
<mainClass>com.tusur.parallel.Start</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>15</source>
<target>15</target>
</configuration>
</plugin>
</plugins>
</build>
enter image description here And module-info.java
module fezas.telegra {
requires javafx.controls;
requires javafx.fxml;
requires javafx.web;
requires java.sql;
requires kernel;
requires barcodes;
requires commons;
requires io;
requires pdfa;
requires forms;
requires styled.xml.parser;
requires hyph;
requires svg;
requires sign;
requires layout;
requires html2pdf;
requires org.slf4j;
requires org.apache.commons.io;
requires java.desktop;
requires jdk.jsobject;
requires ckeditor;
requires com.google.zxing;
requires com.google.zxing.javase;
opens fezas.telegra to javafx.fxml;
opens fezas.telegra.controllers to javafx.fxml;
opens fezas.telegra.entity to javafx.fxml;
exports fezas.telegra;
exports fezas.telegra.controllers;
exports fezas.telegra.dao;
exports fezas.telegra.util;
exports fezas.telegra.entity;
}
The program from the IDE works fine. After javafx:jlink
:
Can't extract module name from itext7-core-7.2.0.pom: Only outputDirectories and jars are accepted on the path Some dependencies encountered issues while attempting to be resolved as modules and will not be included in the classpath; you can change this behavior via the 'includePathExceptionsInClasspath' configuration parameter. Required filename-based automodules detected. Please don't publish this project to a public artifact repository! All logs:
[INFO]
[INFO] ---------------------------< fezas:telegra >----------------------------
[INFO] Building telegra 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ telegra ---
[INFO] Deleting C:\Users\Fezas\telegra\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ telegra ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 44 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ telegra ---
[WARNING] Can't extract module name from itext7-core-7.2.0.pom: zip END header not found
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 62 source files to C:\Users\Fezas\telegra\target\classes
[INFO] /C:/Users/Fezas/telegra/src/main/java/fezas/telegra/util/EditCell.java: C:\Users\Fezas\telegra\src\main\java\fezas\telegra\util\EditCell.java uses unchecked or unsafe operations.
[INFO] /C:/Users/Fezas/telegra/src/main/java/fezas/telegra/util/EditCell.java: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] >>> javafx-maven-plugin:0.0.8:jlink (default-cli) > process-classes @ telegra >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ telegra ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 44 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ telegra ---
[WARNING] Can't extract module name from itext7-core-7.2.0.pom: zip END header not found
[WARNING] *********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 62 source files to C:\Users\Fezas\telegra\target\classes
[INFO] /C:/Users/Fezas/telegra/src/main/java/fezas/telegra/util/EditCell.java: C:\Users\Fezas\telegra\src\main\java\fezas\telegra\util\EditCell.java uses unchecked or unsafe operations.
[INFO] /C:/Users/Fezas/telegra/src/main/java/fezas/telegra/util/EditCell.java: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] <<< javafx-maven-plugin:0.0.8:jlink (default-cli) < process-classes @ telegra <<<
[INFO]
[INFO]
[INFO] --- javafx-maven-plugin:0.0.8:jlink (default-cli) @ telegra ---
[WARNING] There are 1 pathException(s). The related dependencies will be ignored.
- exception: Only outputDirectories and jars are accepted on the path
[WARNING] Can't extract module name from itext7-core-7.2.0.pom: Only outputDirectories and jars are accepted on the path
Error: automatic module cannot be used with jlink: org.slf4j from file:///C:/Users/Fezas/.m2/repository/org/slf4j/slf4j-api/1.7.32/slf4j-api-1.7.32.jar
[ERROR] Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
at org.apache.commons.exec.DefaultExecutor.executeInternal (DefaultExecutor.java:404)
at org.apache.commons.exec.DefaultExecutor.execute (DefaultExecutor.java:166)
at org.openjfx.JavaFXBaseMojo.executeCommandLine (JavaFXBaseMojo.java:567)
at org.openjfx.JavaFXBaseMojo.executeCommandLine (JavaFXBaseMojo.java:434)
at org.openjfx.JavaFXJLinkMojo.execute (JavaFXJLinkMojo.java:209)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:64)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:564)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
at org.codehaus.classworlds.Launcher.main (Launcher.java:47)
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
at org.openjfx.JavaFXBaseMojo.executeCommandLine(JavaFXBaseMojo.java:567)
at org.openjfx.JavaFXBaseMojo.executeCommandLine(JavaFXBaseMojo.java:434)
at org.openjfx.JavaFXJLinkMojo.execute(JavaFXJLinkMojo.java:209)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
Now I have used JPackageScriptFX as jewelsea said (thanks). But after installing msi
C:\Users\Fezas\JPackageScriptFX>JPackageScriptFX.exe
Exception in thread "main" java.lang.NoClassDefFoundError: java/sql/SQLException
at fezas.telegra.TelegraStart.main(TelegraStart.java:5)
Caused by: java.lang.ClassNotFoundException: java.sql.SQLException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
... 1 more
Failed to launch JVM
Solution
The solution with JPackageScriptFX is the best. Thanks Jewelsea. Jmods from javafx copied to C:/jdk/jmods. Then in bat file
set manual_modules=,jdk.crypto.ec,jdk.localedata,javafx.controls,javafx.fxml,javafx.web,java.sql
I finally got a working application weighing only 100 MB:)!
Answered By - Fezas
Answer Checked By - Mary Flores (JavaFixing Volunteer)