0

I'm trying to run and help develop a Java project (https://github.com/goxr3plus/XR3Player) with Java-12 and Maven.

According to the README it requires multiple VM options to be set. This one is representative:

--add-exports javafx.base/com.sun.javafx.binding=com.jfoenix

The project has both JavaFX and JFoenix as dependencies. The packages mentioned in add-exports are not packages of the project source, but of the dependencies.

Adding VM options is easy in IntelliJ, but I would prefer to have this setting as a part of the repository. Can Maven or module-info.java be used for this?

According to some sources (https://www.jrebel.com/blog/java-9-modules-cheat-sheet), --add-exports is a command line equivalent of the exports clause of module-info.java.

I've tried to use the export or exports clause in module-info.java, but haven't found anything that is accepted by the IDE. Maybe because the module/package mentioned in the VM option is not part of the sources that the module-info.java cover.

Is there a solution?

Naman
  • 27,789
  • 26
  • 218
  • 353
Helge
  • 145
  • 9
  • 1
    1. Tagged with Java-12 specifically to see if the underlying libraries have come up with a solution or support for it. 2. Nevertheless, updating your project's `module-info` wouldn't really help, you would need to get an update from those underlying library owners. 3. You can try to hack the javafx jars to add the entries in its `MANIFEST.MF` before you use a dependency on them. – Naman Jun 16 '21 at 11:28
  • `--add-exports javafx.base/com.sun.javafx.binding=com.jfoenix` is equivalent to adding `exports com.sun.javafx.binding to com.jfoenix` in the `module-info.java` **of `javafx.base`**. – dan1st Jun 16 '21 at 11:28
  • Quoting from [this answer](https://stackoverflow.com/a/53037601/1746118), "The ideal solution to that would be the jfoenix library to move away from using com.sun.javafx.scene.control.behavior.TabPaneBehavior". Then from the looks of it [Jfoenix relies on JavaFX](https://github.com/sshahine/JFoenix/issues/862#issuecomment-433937658) to work out a solution. Following up, I would suggest, to try out updating to the latest version in your pom at line [`12.0.2`](https://github.com/goxr3plus/XR3Player/blob/master/pom.xml#L24). e.g. `16` as latest stable release. – Naman Jun 16 '21 at 11:43
  • 1
    In Maven you can set the option in the appropriate goal or whatever they're called (via the POM). You should be doing that anyway considering IntelliJ should be delegating all build tasks to Maven. In other words, when using Maven, Gradle, or some other build tool you shouldn't need to add `--add-exports` to IntelliJ because IntelliJ is no longer responsible for building or executing your project—the build tool is. When you deploy your application you might want to use something like `jpackage` which allows you to specify JVM options to be used when executing the application. – Slaw Jun 16 '21 at 20:11

0 Answers0