Coder Social home page Coder Social logo

working with module-info.java about chart-fx HOT 9 CLOSED

fair-acc avatar fair-acc commented on August 11, 2024
working with module-info.java

from chart-fx.

Comments (9)

ennerf avatar ennerf commented on August 11, 2024 1

@hannabasha jlink requires fully specified modules, i.e., they need to a modules.java file that specifies all dependencies. You can technically use moditect to modularize existing chars, but doing this for all dependencies is a monumental effort. Even after doing all that you will likely keep running into many other issues that will take a really long time or may even be impossible to do.

What I'm suggesting as a workaround is to use jlink to create a custom runtime that is able to run non-modular applications.

I've implemented the following workflow as a cross-platform maven-ant task:

  1. Setup; Download JDK and OpenJFX jmods, extraction, etc.
  2. Use jlink to generate a minimal runtime-image that includes the required JDK and OpenJFX modules
  3. Generate an application-image that includes all other libraries and user code. This is pretty much just a copy of all jar files as well as app resources like icons and so on. I usually just generate a shrunk uber-jar (e.g. ProGuard) so it only has to copy one file.
  4. Use jpackage (JDK14) to generate a natively executable image with the previously generated runtime-image and application-image

I've tested this approach on OpenJDK 11-14 / OpenJFX 11-14 with various versions of chart-fx and was able to get everything running. It also lets you generate various installers like msi and dmg.

from chart-fx.

RalphSteinhagen avatar RalphSteinhagen commented on August 11, 2024

@hannabasha thanks for your feedback and interest in using chart-fx!

I am not a gradle expert (we mostly use Maven internally). Through Maven the following compatible JavaFX version is automatically pulled:
javafx-* version: 13.0.1
batik-* version: 1.12
These seems to be different than yours. We haven't tested this with JavaFX 14. Could you retry this with the latest chart-fx release (11.1.4) and versions mentioned above? Thanks in advance.

Maybe @ennerf can help/knows more about this.

from chart-fx.

hannabasha avatar hannabasha commented on August 11, 2024

@RalphSteinhagen
Thanks for your quick reply!

I tried including javafx 13 and not I get 66 errors "Posted at the end of this comment". They all seem to be trying to access 'org.w3c.dom' or 'org.w3c.dom.events' from two different locations. I tried using javafx version 13.0.1 but I don't use batik, should I? I am not familiar with it anyways.

error: the unnamed module reads package org.w3c.dom from both batik.ext and java.xml
error: the unnamed module reads package org.w3c.dom from both batik.ext and java.xml

error: the unnamed module reads package org.w3c.dom.events from both batik.ext and java.xml
error: the unnamed module reads package org.w3c.dom.events from both batik.ext and java.xml

error: module javafx.controlsEmpty reads package org.w3c.dom from both batik.ext and java.xml
error: module javafx.controlsEmpty reads package org.w3c.dom from both batik.ext and java.xml

error: module javafx.controlsEmpty reads package org.w3c.dom.events from both batik.ext and java.xml
error: module javafx.controlsEmpty reads package org.w3c.dom.events from both batik.ext and java.xml

error: module javafx.mediaEmpty reads package org.w3c.dom from both batik.ext and java.xml
error: module javafx.mediaEmpty reads package org.w3c.dom from both batik.ext and java.xml

error: module javafx.mediaEmpty reads package org.w3c.dom.events from both batik.ext and java.xml
error: module javafx.mediaEmpty reads package org.w3c.dom.events from both batik.ext and java.xml

error: module javafx.graphicsEmpty reads package org.w3c.dom from both batik.ext and java.xml
error: module javafx.graphicsEmpty reads package org.w3c.dom.events from both batik.ext and java.xml
error: module javafx.graphicsEmpty reads package org.w3c.dom from both batik.ext and java.xml

error: module javafx.graphicsEmpty reads package org.w3c.dom.events from both batik.ext and java.xml

error: module javafx.baseEmpty reads package org.w3c.dom from both batik.ext and java.xml
error: module javafx.baseEmpty reads package org.w3c.dom.events from both batik.ext and java.xml
error: module javafx.baseEmpty reads package org.w3c.dom from both batik.ext and java.xml

error: module javafx.baseEmpty reads package org.w3c.dom.events from both batik.ext and java.xml

error: module chartfx.math reads package org.w3c.dom from both batik.ext and java.xml
error: module chartfx.math reads package org.w3c.dom from both batik.ext and java.xml

error: module chartfx.math reads package org.w3c.dom.events from both batik.ext and java.xml
error: module chartfx.math reads package org.w3c.dom.events from both batik.ext and java.xml

error: module javafxsvg reads package org.w3c.dom from both batik.ext and java.xml
error: module javafxsvg reads package org.w3c.dom from both batik.ext and java.xml

error: module javafxsvg reads package org.w3c.dom.events from both batik.ext and java.xml
error: module javafxsvg reads package org.w3c.dom.events from both batik.ext and java.xml

error: module com.ibm.icu reads package org.w3c.dom from both batik.ext and java.xml
error: module com.ibm.icu reads package org.w3c.dom from both batik.ext and java.xml

error: module com.ibm.icu reads package org.w3c.dom.events from both batik.ext and java.xml
error: module com.ibm.icu reads package org.w3c.dom.events from both batik.ext and java.xml

error: module it.unimi.dsi.fastutil reads package org.w3c.dom from both batik.ext and java.xml
error: module it.unimi.dsi.fastutil reads package org.w3c.dom from both batik.ext and java.xml

error: module it.unimi.dsi.fastutil reads package org.w3c.dom.events from both batik.ext and java.xml
error: module it.unimi.dsi.fastutil reads package org.w3c.dom.events from both batik.ext and java.xml

error: module JTransforms reads package org.w3c.dom from both batik.ext and java.xml
error: module JTransforms reads package org.w3c.dom from both batik.ext and java.xml

error: module JTransforms reads package org.w3c.dom.events from both batik.ext and java.xml
error: module JTransforms reads package org.w3c.dom.events from both batik.ext and java.xml

error: module JLargeArrays reads package org.w3c.dom from both batik.ext and java.xml
error: module JLargeArrays reads package org.w3c.dom from both batik.ext and java.xml

error: module JLargeArrays reads package org.w3c.dom.events from both batik.ext and java.xml
error: module JLargeArrays reads package org.w3c.dom.events from both batik.ext and java.xml

error: module commons.math3 reads package org.w3c.dom from both batik.ext and java.xml
error: module commons.math3 reads package org.w3c.dom.events from both batik.ext and java.xml
error: module batik.transcoder reads package org.w3c.dom from both batik.ext and java.xml
error: module commons.math3 reads package org.w3c.dom from both batik.ext and java.xml

error: module commons.math3 reads package org.w3c.dom.events from both batik.ext and java.xml

error: module batik.transcoder reads package org.w3c.dom from both batik.ext and java.xml

error: module batik.transcoder reads package org.w3c.dom.events from both batik.ext and java.xml
error: module batik.transcoder reads package org.w3c.dom.events from both batik.ext and java.xml

error: module xmlgraphics.commons reads package org.w3c.dom from both batik.ext and java.xml
error: module xmlgraphics.commons reads package org.w3c.dom from both batik.ext and java.xml

error: module xmlgraphics.commons reads package org.w3c.dom.events from both batik.ext and java.xml
error: module xmlgraphics.commons reads package org.w3c.dom.events from both batik.ext and java.xml

error: module batik.bridge reads package org.w3c.dom from both batik.ext and java.xml
error: module batik.bridge reads package org.w3c.dom from both batik.ext and java.xml

error: module batik.bridge reads package org.w3c.dom.events from both batik.ext and java.xml
error: module batik.bridge reads package org.w3c.dom.events from both batik.ext and java.xml

error: module batik.script reads package org.w3c.dom from both batik.ext and java.xml
error: module batik.script reads package org.w3c.dom from both batik.ext and java.xml

error: module batik.script reads package org.w3c.dom.events from both batik.ext and java.xml
error: module batik.script reads package org.w3c.dom.events from both batik.ext and java.xml

error: module batik.anim reads package org.w3c.dom from both batik.ext and java.xml
error: module batik.anim reads package org.w3c.dom from both batik.ext and java.xml

error: module batik.anim reads package org.w3c.dom.events from both batik.ext and java.xml
error: module batik.anim reads package org.w3c.dom.events from both batik.ext and java.xml

error: module batik.gvt reads package org.w3c.dom from both batik.ext and java.xml
error: module batik.gvt reads package org.w3c.dom from both batik.ext and java.xml

error: module batik.gvt reads package org.w3c.dom.events from both batik.ext and java.xml
error: module batik.gvt reads package org.w3c.dom.events from both batik.ext and java.xml

error: module batik.svggen reads package org.w3c.dom from both batik.ext and java.xml
error: module batik.svggen reads package org.w3c.dom from both batik.ext and java.xml

error: module batik.svggen reads package org.w3c.dom.events from both batik.ext and java.xml
error: module batik.svggen reads package org.w3c.dom.events from both batik.ext and java.xml

error: module batik.svg.dom reads package org.w3c.dom from both batik.ext and java.xml
error: module batik.svg.dom reads package org.w3c.dom from both batik.ext and java.xml

error: module batik.svg.dom reads package org.w3c.dom.events from both batik.ext and java.xml
error: module batik.svg.dom reads package org.w3c.dom.events from both batik.ext and java.xml

error: module batik.parser reads package org.w3c.dom from both batik.ext and java.xml
error: module batik.parser reads package org.w3c.dom from both batik.ext and java.xml

error: module batik.parser reads package org.w3c.dom.events from both batik.ext and java.xml
error: module batik.parser reads package org.w3c.dom.events from both batik.ext and java.xml

error: module batik.awt.util reads package org.w3c.dom from both batik.ext and java.xml
error: module batik.awt.util reads package org.w3c.dom from both batik.ext and java.xml

error: module batik.awt.util reads package org.w3c.dom.events from both batik.ext and java.xml
error: module batik.awt.util reads package org.w3c.dom.events from both batik.ext and java.xml

error: module batik.dom reads package org.w3c.dom from both batik.ext and java.xml
error: module batik.dom reads package org.w3c.dom from both batik.ext and java.xml

error: module batik.dom reads package org.w3c.dom.events from both batik.ext and java.xml
error: module batik.dom reads package org.w3c.dom.events from both batik.ext and java.xml

error: module batik.xml reads package org.w3c.dom from both batik.ext and java.xml
error: module batik.xml reads package org.w3c.dom from both batik.ext and java.xml

error: module batik.xml reads package org.w3c.dom.events from both batik.ext and java.xml
error: module batik.xml reads package org.w3c.dom.events from both batik.ext and java.xml

error: module batik.css reads package org.w3c.dom from both batik.ext and java.xml
error: module batik.css reads package org.w3c.dom from both batik.ext and java.xml

error: module batik.css reads package org.w3c.dom.events from both batik.ext and java.xml
error: module batik.css reads package org.w3c.dom.events from both batik.ext and java.xml

error: module batik.util reads package org.w3c.dom from both batik.ext and java.xml
error: module batik.util reads package org.w3c.dom from both batik.ext and java.xml

error: module batik.util reads package org.w3c.dom.events from both batik.ext and java.xml
error: module batik.util reads package org.w3c.dom.events from both batik.ext and java.xml

error: module batik.ext reads package org.w3c.dom from both batik.ext and java.xml
error: module batik.ext reads package org.w3c.dom from both batik.ext and java.xml

error: module batik.ext reads package org.w3c.dom.events from both batik.ext and java.xml
error: module batik.ext reads package org.w3c.dom.events from both batik.ext and java.xml

error: module xalan reads package org.w3c.dom from both batik.ext and java.xml
error: module xalan reads package org.w3c.dom from both batik.ext and java.xml

error: module xalan reads package org.w3c.dom.events from both batik.ext and java.xml
error: module xalan reads package org.w3c.dom.events from both batik.ext and java.xml

error: module xml.apis.ext reads package org.w3c.dom from both batik.ext and java.xml
error: module xml.apis.ext reads package org.w3c.dom from both batik.ext and java.xml

error: module xml.apis.ext reads package org.w3c.dom.events from both batik.ext and java.xml
error: module commons.io reads package org.w3c.dom from both batik.ext and java.xml
error: module xml.apis.ext reads package org.w3c.dom.events from both batik.ext and java.xml

error: module commons.io reads package org.w3c.dom from both batik.ext and java.xml

error: module commons.io reads package org.w3c.dom.events from both batik.ext and java.xml
error: module commons.io reads package org.w3c.dom.events from both batik.ext and java.xml

error: module commons.logging reads package org.w3c.dom from both batik.ext and java.xml
error: module commons.logging reads package org.w3c.dom from both batik.ext and java.xml

error: module commons.logging reads package org.w3c.dom.events from both batik.ext and java.xml
error: module commons.logging reads package org.w3c.dom.events from both batik.ext and java.xml

error: module chartfx.dataset reads package org.w3c.dom from both batik.ext and java.xml
error: module chartfx.dataset reads package org.w3c.dom from both batik.ext and java.xml

error: module chartfx.dataset reads package org.w3c.dom.events from both batik.ext and java.xml
error: module chartfx.dataset reads package org.w3c.dom.events from both batik.ext and java.xml

error: module chartfx.chart reads package org.w3c.dom from both batik.ext and java.xml
error: module chartfx.chart reads package org.w3c.dom from both batik.ext and java.xml

error: module chartfx.chart reads package org.w3c.dom.events from both batik.ext and java.xml
error: module chartfx.chart reads package org.w3c.dom.events from both batik.ext and java.xml

66 errors

from chart-fx.

RalphSteinhagen avatar RalphSteinhagen commented on August 11, 2024

batik is being pulled in via the 'javafxsvg' package. It's needed for reading in the icons. Just to confirm, you can compile and run the examples?!?

from chart-fx.

ennerf avatar ennerf commented on August 11, 2024

Gradle should be pulling the same dependencies. Maybe you have another dependency that is pulling another version? It'd be good to check the dependency tree (see debugging dependencies)

Out of curiousity, what's your reason for needing a modular jar file? There may be other ways to achieve the same goal (e.g. a standalone jlink app?) that don't require full modularization.

FWIW ever since Java 9 was released I've spent weeks on trying to work with modular jars, but at some point I've always encountered different insurmountable issues related to build tools, combining non-modular with modular jar files, or the giant can of worms of MR jars. There are some plugins like moditect that exist to help with the migration, but be prepared to fall into a giant rabbit hole.

from chart-fx.

ennerf avatar ennerf commented on August 11, 2024

On a related note, it'd be good if chart-fx would specify an automatic module name via the Manifest (see example).

Background on Automatic-Module-Name

from chart-fx.

wirew0rm avatar wirew0rm commented on August 11, 2024

I'm also not very familiar with gradle, but I'm irritated by the compile group line you are using, as maven central suggests implementation 'de.gsi.chart:chartfx-chart:11.1.4' for using chartfx with gradle. Are you trying to build chartfx yourself as part of your own compile process instead of using the prebuilt jars from maven central or is this somehow different for modularized builds?

When we modularized chartfx and started uploading to maven central we also tried to add a module descriptor and I can second @ennerf's experience. Regarding automatic module name, I remember reading the article you linked, but probably that while I was still trying to go full modularized. It should not be a problem to add it to our pom, I'll try a PR later.

from chart-fx.

hannabasha avatar hannabasha commented on August 11, 2024

@RalphSteinhagen I didn't try to run the samples. I was just getting started with my application and I wanted to set up the charts.

@ennerf I am going with the modular jar file to do jlink. I am a beginner in gradle and so thanks for sharing the idea of having a standlone jlink. I will try that. So, what I got from you is that I can't have a modular project because chartfx as a dependency is not modular, right?

@wirew0rm I am looking at this for my dependencies and they suggested compile group. I should try your suggestion of having the implementation. I am sorry, I don't know the difference but I will read more about it. Are you suggesting that the implements should work with a modular project?

from chart-fx.

hannabasha avatar hannabasha commented on August 11, 2024

@ennerf Thank you! I will try that!

And thanks for all the responses and your kindness! I believe I got my answer and I am closing this!

from chart-fx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.