FXMisc / RichTextFX

Rich-text area for JavaFX
BSD 2-Clause "Simplified" License
1.2k stars 237 forks source link

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

Open jwdevantier opened 1 year ago

jwdevantier commented 1 year ago

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:

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 2 months ago

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