How to solve java.lang.module.FindException: Module gson.extras not found? - java

I have dependencies in build.gradle:
dependencies {
implementation 'com.google.code.gson:gson:2.10'
testImplementation("org.junit.jupiter:junit-jupiter-api:${junitVersion}")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${junitVersion}")
implementation 'org.danilopianini:gson-extras:1.1.0'
}
In module-info.java I have:
module qu4lizz.taskscheduler {
requires javafx.controls;
requires javafx.fxml;
requires java.desktop;
requires com.google.gson;
requires gson.extras;
opens qu4lizz.taskscheduler.gui to javafx.fxml;
opens qu4lizz.taskscheduler.my_task to javafx.fxml;
exports qu4lizz.taskscheduler.gui;
exports qu4lizz.taskscheduler.my_task;
}
When I try to build this project I get error:
Error occurred during initialization of boot layer
java.lang.module.FindException: Module gson.extras not found, required by qu4lizz.taskscheduler
:GUI.main() (Thread[Execution worker Thread 4,5,main]) completed. Took 0.175 secs.
Execution failed for task ':GUI.main()'.
> Process 'command '/home/qu4lizz/.jdks/corretto-17.0.4.1/bin/java'' finished with non-zero exit value 1
I don't have any idea how to solve this.

Related

Trouble linking module to javafx.base

Receiving error when running application
module javafx.base cannot access class Model.Country (in module rbrod.scheduleapp) because module rbrod.scheduleapp does not open Model to javafx.base
File Structure:
main >
java >
Controller
Database
DBAccess
Model
rbrod.scheduleapp
resources >
fxml
module-info.java structure
module rbrod.scheduleapp {
requires javafx.controls;
requires javafx.fxml;
requires java.sql;
requires mysql.connector.j;
opens rbrod.scheduleapp to javafx.fxml;
opens Controller to javafx.fxml;
opens Model to javafx.fxml;
exports rbrod.scheduleapp;
}
Tried adding "opens Controller to javafx.fxml" amd "opens Model to javafx.fxml" to module-info.java

Gradle JavaFX Jlink : duplicate module on application module path

I have a project working with gradle and everything build and run perfectly but I have issues packaging my application. I work on WSL and would like to have both linux and windows executables but to begin having one is okay I don't really care as long as it works and I can understand how to replicate it on the other OS.
So far, I have read a lot of things on the internet and tried to use this plugin in order to package my application. But when I use gradle jlink, I am warned about a duplicate module issue as you can see below. I have tried many things but cannot find anythign which works or a similar problem on the web. Would you have any clue on what I may be overlooking because of my inexperience?
Thank you in advance !
Starting a Gradle Daemon, 31 busy and 1 incompatible and 12 stopped Daemons could not be reused, use --status for details
> Configure project :
Project : => 'CharacterCreator' Java module
> Task :createMergedModule
error: duplicate module on application module path
module in javafx.base
error: duplicate module on application module path
module in javafx.controls
2 errors
> Task :createMergedModule FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':createMergedModule'.
> Process 'command '/opt/graalvm-svm-java11-linux-gluon-22.1.0.1-Final/bin/javac'' finished with non-zero exit value 1
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 42m 15s
5 actionable tasks: 3 executed, 2 up-to-date
Here is my gradle.build file :
plugins {
id 'java'
id 'org.openjfx.javafxplugin' version '0.0.13'
id 'org.beryx.jlink' version '2.16.2'
}
repositories {
mavenCentral()
mavenLocal()
}
javafx {
version = "19"
modules = [ 'javafx.controls', 'javafx.fxml' ]
}
dependencies {
implementation "org.aerofx:aerofx:0.2"
implementation "pdfbox:pdfbox:0.7.3"
implementation "org.javatuples:javatuples:1.2"
implementation "org.controlsfx:controlsfx:11.0.3"
implementation "org.mariadb.jdbc:mariadb-java-client:2.1.2"
implementation "io.gitlab.vincent-lambert:miscellaneousWidgets:1.7"
implementation "org.apache.httpcomponents:httpclient:4.5.13"
implementation "org.apache.httpcomponents:httpmime:4.3.1"
}
application {
mainModule = 'CharacterCreator'
mainClass = 'CharacterCreator.Menu.App'
}
tasks.withType(JavaCompile) {
options.compilerArgs << '-Xlint:unchecked'
options.deprecation = true
}
jlink {
options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
launcher{
name = 'hello'
jvmArgs = ['-Dlog4j.configurationFile=./log4j2.xml']
}
}
And my module-info file :
module CharacterCreator {
requires aerofx;
requires javafx.fxml;
requires pdfbox;
requires javatuples;
requires java.sql;
requires javafx.base;
requires javafx.graphics;
requires javafx.controls;
requires org.controlsfx.controls;
requires mariadb.java.client;
requires miscellaneousWidgets;
requires java.desktop;
requires java.net.http;
requires httpmime;
opens CharacterCreator.Creator to javafx.fxml;
exports CharacterCreator.Creator;
opens CharacterCreator.Edits to javafx.fxml;
exports CharacterCreator.Edits;
opens CharacterCreator.Menu to javafx.fxml;
exports CharacterCreator.Menu;
opens CharacterCreator.Misc to javafx.fxml;
exports CharacterCreator.Misc;
opens CharacterCreator.Races to javafx.fxml;
exports CharacterCreator.Races;
opens CharacterCreator.Relations to javafx.fxml;
exports CharacterCreator.Relations;
opens CharacterCreator.Visus to javafx.fxml;
exports CharacterCreator.Visus;
}
I had the same problem, and I found out, that the folder build/jlinkbase/jlinkjars contained mentioned modules for both platform - mac (which I use to develop) and win.
after reading https://github.com/openjfx/javafx-gradle-plugin/issues/65 I just needed to identify the "polluting" library and applied the fix, which was mentioned:
implementation (....) { exclude group:org.openjfx }

Module not found: javafx.web

I wanted to create a WebView with Javafx, and I added requires javafx.web; to my module-info.jar, but IntelliJ say: "Module not found: javafx.web".
requires javafx.controls;
requires javafx.fxml;
requires javafx.base;
requires javafx.graphics;
works without any problem.
What can I do?
Have you also added a dependency to javafx-web in Maven/Gradle or added the corresponding jar file to your build?

JavaFX 11 OpenJDK module-info.java

Error:(1,1) java: module Reports reads package java.awt from both java.desktop and java.datatransfer
I'm clueless to this problem and how to fix it.
module-info.java is as follows:
module Reports {
requires javafx.graphics;
requires com.jfoenix;
requires javafx.fxml;
requires javafx.controls;
requires java.sql;
requires org.joda.time;
requires jna;
requires jna.platform;
requires java.datatransfer;
requires java.desktop;
}
My module-info.java looks like this:
module Alemungula {
requires javafx.graphics;
requires javafx.fxml;
requires javafx.controls;
opens sample;
}
I think you miss open statement where sample is your starter file.

Import PropertyValueFactory cannot be resolved

As the title says:
Somehow java can't find the PropertyValueFactory class, although it is in the system library (as seen in the picture at the link) and I've got no idea why.
Other classes from that package are working, just this specific one doesn't...
I'm using JDK 9.0.4 with Eclipse 4.7.3
import javafx.scene.control.cell.PropertyValueFactory;
module javafx.controls {
requires transitive javafx.base;
requires transitive javafx.graphics;
And here is module-info.class:
module javafx.controls {
requires transitive javafx.base;
requires transitive javafx.graphics;
exports javafx.scene.chart;
exports javafx.scene.control;
exports javafx.scene.control.cell;
exports javafx.scene.control.skin;
exports com.sun.javafx.scene.control to
javafx.web;
exports com.sun.javafx.scene.control.behavior to
javafx.web;
exports com.sun.javafx.scene.control.inputmap to
javafx.web;
exports com.sun.javafx.scene.control.skin to
javafx.graphics,
javafx.web;
}
Screen of the problem

Categories