Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is this project even usable with a modern JDK and modular JavaFX? #1174

Open
jwdevantier opened this issue Feb 28, 2023 · 4 comments
Open

Is this project even usable with a modern JDK and modular JavaFX? #1174

jwdevantier opened this issue Feb 28, 2023 · 4 comments

Comments

@jwdevantier
Copy link

jwdevantier commented Feb 28, 2023

As asked.

I have basically written ~95% of the application I'd like to have, only to find out that I can't really package and run it outside of IntelliJ - or rather, I have no clue how.

My limited understanding is thus:

  • JavaFX is no longer part of the JRE/JDK
  • (?) JRE's are no longer much of a thing(?), you're supposed to build a bespoke runtime using jlink?
  • jlink is basically useless - all jars/deps must be modular - reactfx, a dependency of richtextfx, is not
  • ....
  • modules missing a module-info.class file are labelled an "automodule", they break "mvn clean compile javafx:jlink"
  • ... so I end up writing a script which unpacks a jar, generates a module-info.java file (jdeps), compiles it (javac + fiddling with where files are located to placate the classpath(?)) and repackages it.
  • ... but there's no way (as far as I can see) of actually USING the patched jar except overriding the one in the .m2 repository or creating a whole custom local repo (file structure and all)
  • ... dead end

Using the maven shaded module plugin is also heavily discouraged, it somehow screws with JavaFX which expects to be loaded as a module (limited understanding).

There's something called moditect, but examples using richtextfx are hard to come by.


Is this project useable with a modern JDK ? How on earth would you package a JavaFX application using RichTextFX ?
Would it please, please be possible to supply such an example? Maven or gradle, who cares.

(I've spent 2 days so far trying to accomplish this - maybe being a relative outsider to the Java ecosystem there's somethin obvious I'm missing, but I really think there's a strong need for a example project which can be cloned, unpacked, built (into a jar or so) and run separate from the project sources.)

Otherwise, may I suggest very clearly warning people off from using this project past Java 8 ? After all, what is the point of writing an application that cannot be distributed in any reasonable fashion.

@Jugen
Copy link
Collaborator

Jugen commented Feb 28, 2023

JavaFX not being part of the JRE does complicate things. Here are two Java distributions that include JavaFX in the JRE:
Liberica Select the full JRE option to include JavaFX.
Azul Select the JRE FX package.

Then just make sure that RichTextFX is on your class-path as usual.
If you must have RichTextFX on the module path, then I suggest using the fat jar provided in releases.

@jwdevantier
Copy link
Author

can you elaborate on this a bit ? Why would that work ? What would I have to do? Use the fat jar as a dependency in a maven pom.xml file or gradle build file..? Anything else ?

Generally, I'd consider this a feature request also - whether a maven archetype or whatever the lingo is - some good base which demonstrates how one might use richtextfx in the modular Java world, with notes on which Java distributions to use if relevant.

@Jugen
Copy link
Collaborator

Jugen commented Mar 1, 2023

Why would that work ?

RichTextFX is not fully module compliant as it has dependencies that are not modules.
In order to get around this the dependencies have been bundled together in an uber/fat jar.

What would I have to do?

You would manually download the fat jar and put it in your project's library/dependency folder. Then configure IntelliJ to use it as a module. (That's how I do it using Eclipse, except I put it on the class-path).
Unfortunately I don't use either Maven or Gradle in my projects so I don't know how it would be done with them.

Note that a Java application can use both the module-path and the class-path at the same time.
So if a library is a module you can put it on the application's module-path, otherwise put it on the class-path.

@PavelTurk
Copy link
Contributor

We work only with JPMS and we use RichTextFX as JPMS modules. It is not important if they are automatic or explicit modules. What is important that they can be loaded to JPMS layer and they dont have split package problems

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants