Module not found: javafx.web - java

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?

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 }

Modules not found when trying to inject module-info.java

I have a JavaFX project that uses Apache's PDFBox. I want to use JLink to build a JRE of it, but I can't since PDFBox is an automodule. Thus, I'm trying to inject a module-info file in it.
I generated this module-info file using jdeps:
module org.apache.pdfbox {
requires org.bouncycastle.pkix;
requires org.bouncycastle.provider;
requires transitive commons.logging;
requires transitive java.desktop;
requires transitive java.xml;
requires transitive org.apache.fontbox;
exports org.apache.pdfbox.contentstream;
exports org.apache.pdfbox.contentstream.operator;
exports org.apache.pdfbox.contentstream.operator.color;
exports org.apache.pdfbox.contentstream.operator.graphics;
exports org.apache.pdfbox.contentstream.operator.markedcontent;
exports org.apache.pdfbox.contentstream.operator.state;
exports org.apache.pdfbox.contentstream.operator.text;
exports org.apache.pdfbox.cos;
exports org.apache.pdfbox.filter;
exports org.apache.pdfbox.io;
exports org.apache.pdfbox.multipdf;
exports org.apache.pdfbox.pdfparser;
exports org.apache.pdfbox.pdfwriter;
exports org.apache.pdfbox.pdmodel;
exports org.apache.pdfbox.pdmodel.common;
exports org.apache.pdfbox.pdmodel.common.filespecification;
exports org.apache.pdfbox.pdmodel.common.function;
exports org.apache.pdfbox.pdmodel.common.function.type4;
exports org.apache.pdfbox.pdmodel.documentinterchange.logicalstructure;
exports org.apache.pdfbox.pdmodel.documentinterchange.markedcontent;
exports org.apache.pdfbox.pdmodel.documentinterchange.prepress;
exports org.apache.pdfbox.pdmodel.documentinterchange.taggedpdf;
exports org.apache.pdfbox.pdmodel.encryption;
exports org.apache.pdfbox.pdmodel.fdf;
exports org.apache.pdfbox.pdmodel.font;
exports org.apache.pdfbox.pdmodel.font.encoding;
exports org.apache.pdfbox.pdmodel.graphics;
exports org.apache.pdfbox.pdmodel.graphics.blend;
exports org.apache.pdfbox.pdmodel.graphics.color;
exports org.apache.pdfbox.pdmodel.graphics.form;
exports org.apache.pdfbox.pdmodel.graphics.image;
exports org.apache.pdfbox.pdmodel.graphics.optionalcontent;
exports org.apache.pdfbox.pdmodel.graphics.pattern;
exports org.apache.pdfbox.pdmodel.graphics.shading;
exports org.apache.pdfbox.pdmodel.graphics.state;
exports org.apache.pdfbox.pdmodel.interactive.action;
exports org.apache.pdfbox.pdmodel.interactive.annotation;
exports org.apache.pdfbox.pdmodel.interactive.annotation.handlers;
exports org.apache.pdfbox.pdmodel.interactive.annotation.layout;
exports org.apache.pdfbox.pdmodel.interactive.digitalsignature;
exports org.apache.pdfbox.pdmodel.interactive.digitalsignature.visible;
exports org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination;
exports org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline;
exports org.apache.pdfbox.pdmodel.interactive.form;
exports org.apache.pdfbox.pdmodel.interactive.measurement;
exports org.apache.pdfbox.pdmodel.interactive.pagenavigation;
exports org.apache.pdfbox.pdmodel.interactive.viewerpreferences;
exports org.apache.pdfbox.printing;
exports org.apache.pdfbox.rendering;
exports org.apache.pdfbox.text;
exports org.apache.pdfbox.util;
exports org.apache.pdfbox.util.filetypedetector;
}
At the jar's folder, I ran:
javac --patch-module org.apache.pdfbox=pdfbox-2.0.20.jar module-info.java
But then I got
pdfbox/module-info.java:2: error: module not found: org.bouncycastle.pkix
requires org.bouncycastle.pkix;
^
pdfbox/module-info.java:3: error: module not found: org.bouncycastle.provider
requires org.bouncycastle.provider;
^
pdfbox/module-info.java:5: error: module not found: commons.logging
requires transitive commons.logging;
^
pdfbox/module-info.java:8: error: module not found: org.apache.fontbox
requires transitive org.apache.fontbox;
^
4 errors
How can I fix this? Is there any better workaround? Thanks in advance.
The project: https://github.com/ajsaraujo/mre-automodule
You cannot use jlink directly because of the automatic module issue. But you can follow this tutorial https://github.com/dlemmermann/JPackageScriptFX which also uses jlink but only to create a dedicated runtime without having to modularize your project. I am also using PDFBox in my project, so I know it works. Disclaimer: I am biased because I am the co-author of the above mentioned tutorial :-)
I found a tutorial about making the module-info.class step by step.
It worked for me to create module-info.class for org.apache.commons.math3 .
https://www.youtube.com/watch?v=bO6f3U4i0A0&t=293
For me, the 'module not found' issue didn't show up.

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