4

EDIT: YOU CAN GO DIRECTLY TO THE 2018-02-13 UPDATE AT THE END OF THE POST FOR UPDATED INFORMATION

I can provide full source code as this problem has appeared in my open source project JMarkPad.

Find it here

The issue

Basically:

  • Building always works, I get a working .jar without any problem.
  • Creating a native dist (running gradle link) WITHOUT 3rd party software (in this case, JFoenix) works too.
  • Creating a native dist (running gradle link) WITH 3rd party software (in this case, JFoenix) throws the following:

:linkAll

:JMarkPad:app:clean

:JMarkPad:app:compileJava

:JMarkPad:app:processResources

:JMarkPad:app:classes

:JMarkPad:app:jar

:JMarkPad:app:link

Error: Module app not found

:JMarkPad:app:link FAILED

:linkAll FAILED

Any experience with this? Please feel free to browse the whole project and ask any question about it, I really need help with this, and I'll gladly help anyone trying to help me.

Thank you for your patience.

Edit:

The jlink command can be found in the app/gradle.build file:

commandLine "${java_home}/bin/jlink", '--module-path', "libs${File.pathSeparatorChar}${java_home}/jmods",
        '--add-modules', 'app', '--launcher', 'app=app/ui.UI', '--output', 'dist', '--strip-debug',
        '--compress', '2', '--no-header-files', '--no-man-pages'

Edit 2: Full error:

9:28:38: Executing task 'link'...

:app:clean
:app:compileJava
:app:processResources
:app:classes
:app:jar
:app:link
Error: Module app not found
:app:link FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:link'.
> Process 'command 'C:\Program Files\Java\jdk-9.0.4/bin/jlink'' 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 1s
5 actionable tasks: 5 executed
Process 'command 'C:\Program Files\Java\jdk-9.0.4/bin/jlink'' finished with non-zero exit value 1
9:28:39: Task execution finished 'link'.

2018-02-13 UPDATE:

https://github.com/mayuso/JMarkPad/tree/java-9-integration

It currently uses a single library, called JFoenix, as can be seen in the dependencies declaration in the build.gradle file here:

https://github.com/mayuso/JMarkPad/blob/java-9-integration/build.gradle

The library in question is present here:

https://github.com/mayuso/JMarkPad/tree/java-9-integration/libs

So now, when I try to run the software using gradle run, compile it using gradle build or make a distribution using jlink it always says error: module not found: com.jfoenix.

I've asked the JFoenix mantainers, a couple Java bloggers that had experience with Java 9 and JLink and no one yet has been able to solve this issue.

Any idea of what am I doing wrong?

Many thanks for your patience.

Community
  • 1
  • 1
Mayuso
  • 1,291
  • 4
  • 19
  • 41
  • @nullpointer Honestly? Not sure, every example i've found used that folder as module path, so I thought it was a default that always had to be added. – Mayuso Jan 18 '18 at 08:31
  • @nullpointer No it's not. Should it? When I remove JFoenix it works fine with that exact command, so not sure if that's the problem. I'm going to try `libs${File.pathSeparatorChar}${java_home}/jmods;app/` (and variations) right now. I'll confirm if it works. – Mayuso Jan 18 '18 at 08:52
  • 1
    @Tuzane Looking further into it, seems like `libs` is the folder you're building the `app` module into and your command might just be `libs;{java_home}/jmods`, which looks fine if the separator is correct for the OS you're using. Also a slight observation :- the examples in the documentation seems to be following the order `JMODS;`, so could you actually try this **`{java_home}/jmods${File.pathSeparatorChar}$libs`**? (though not sure if the order shall matter there) – Naman Jan 18 '18 at 08:55
  • @nullpointer Same error. Changing the order doesn't help, and btw. I just realized libs is actually useless, as I don't have any libs folder myself, the only dependency I have is JFoenix and I get it via gradle dependencies, I don't actually have the .jar in a libs folder. I should probably replace libs for app or something like that? Makes sense to me, going to try. – Mayuso Jan 18 '18 at 09:09
  • 1
    The `libs` is supposedly the directory where you would build the module definition of your `app` and makes sense to append it to the modulepath. What I still don't see is how is removing the *JFoenix components* as you say, you're able to successfully *create the `app` module* and then link it using jlink. Reference - [jlink documentation](https://docs.oracle.com/javase/9/tools/jlink.htm#JSWOR-GUID-CECAC52B-CFEE-46CB-8166-F17A8E9280E9) – Naman Jan 18 '18 at 09:14
  • Have you considered the possibility that the jlink module-path is an ordered list of locations. I tried altered a library to put openJFX internals before the javafx.* modules. It then linked and ran as a jlink image. I am old enough to recall this was important 30 years ago when building Fortran IV programs. Reading the jlink documentation did not mention this. – Emma Atkinson Nov 07 '18 at 14:12

0 Answers0