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

Support for current JDK 9, JDK 10, JDK 11, JDK 12, JDK 13, JDK 14, JDK 15, JDK 16 ... #287

Open
FibreFoX opened this issue Apr 5, 2017 · 28 comments

Comments

@FibreFoX
Copy link
Member

FibreFoX commented Apr 5, 2017

As there are a lot of internal changes inside the JDK 9, this maven-plugin has to be made compatible.

Most notable changes are the added options for java-module and different locations of some packager-classes (which are located inside ${JAVA_HOME}/jmods/jdk.packager.jmod) and the classes for UserJvmOptionsService (now inside ${JAVA_HOME}/jmods/jdk.packager.jmod)

@FibreFoX
Copy link
Member Author

FibreFoX commented Apr 5, 2017

@dlemmermann
Copy link

Any news on Java 9 support for this plugin?

@og0815
Copy link
Contributor

og0815 commented Dec 26, 2017

+1 from me on this one.

@FibreFoX
Copy link
Member Author

Anyone who is interested of testing the current snapshot-version (8.9.0-SNAPSHOT), should use the following:

<pluginRepositories>
    <pluginRepository>
        <id>oss-sonatype-snapshots</id>
        <url>https://oss.sonatype.org/content/groups/public/</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </pluginRepository>
</pluginRepositories>
<build>
    <plugins>
        <plugin>
            <groupId>com.zenjava</groupId>
            <artifactId>javafx-maven-plugin</artifactId>
            <version>8.9.0-SNAPSHOT</version>
        </plugin>
    </plugins>
</build>

It was required to remove some MacOSX-workaround (had to delete it making it compile), but i doubt this feature was used a lot (will wait for feedback on this one). This was compiled using JDK 9, but I hope this does not create any trouble for you.

As there are no special options for setting the new JDK 9 module things, please use the generic <bundleArguments> built-in hack:

<bundleArguments>
    <!-- "--module-path" -->
    <module-path>PATH_1;PATH_2;PATH_3</module-path><!-- use File.pathSeparator !!! os-dependant -->

    <!-- "--module" -->
    <module>module1,module2,module3</module>

    <!-- "--add-modules" -->
    <add-modules>module1,module2,module3</add-modules>

    <!-- "--limit-modules" -->
    <limit-modules>module1,module2,module3</limit-modules>
</bundleArguments>

For all the developers using the <runtime />-hack to disable bundling the JRE, this seems to not being supported (but I just might have missed the corresponding map-parameter for this).

Hoping for your feedback, thanks a lot in advance and sorry for over four month of delay after official JDK 9 release.

@FibreFoX FibreFoX modified the milestones: v9.0.0, v8.9.0 Jan 21, 2018
@TapaniRundgren
Copy link

Great! Works - almost (my custom icon is not included anymore, works in 8.8.3)
Using JDK 9.0.4

@danielpeintner
Copy link

danielpeintner commented Jan 25, 2018

Thanks @FibreFoX for all your work. I really appreciate your efforts!

I did give 8.9.0-SNAPSHOT a try. First everything seems to work just fine. It creates the Jar in target\jfx correctly and I can launch the app. Unfortunately in my case this is not the case for the executable in target\jfx\native. The installer works but the exe fails to launch. Also when using the installer.

I am on Windows7 (64Bit) with latest InnoSetup v. 5.5.9.

While running mvn jfx:native I do not get any issues. The .exe is created just fine. When trying to launch the executable I get the following meaningless message.

java9testfailure

Since I do not know how to give you additional information I uploaded the test project on github.
https://github.com/danielpeintner/Java9Test

I did try the same project with Java8 and it works fine.

Hope this helps to identify the issue,

Thanks!

Note: I tried to compare a bit what gets created with JDK8 vs JDK9.
On the root level of jfx\native\Java9Test both have Java9Test.exe and Java9Test.ico. Besides that JDK8 has some .dll files which JDK9 is missing.
In directory jfx\native\Java9Test\app of JDK9 there is just one file Java9Test.cfg and it misses all required Jar files. I assume that is the problem. Some files don't get copied properly...

@FibreFoX
Copy link
Member Author

FibreFoX commented Jan 25, 2018

@TapaniRundgren @danielpeintner thanks for checking the latest plugin, seems that I broke something important, or javapackager is expecting something different. Let the search begin ;) will report back after success.

EDIT: I think I found the problem, lets tinker around ....

// (Open)JDK 9 - WindowsAppImageBuilder
Files.copy(new File(srcdir, fname).toPath(), new File(appDir.toFile(), fname).toPath());
// (Open)JDK 8 - WinAppBundler
IOUtils.copyFile(new File(srcdir, fname), new File(appDirectory, fname));

seems a bit complicated, I get a one "java.nio.file.NoSuchFileException" entry, and all other entries inside this (the only one) RelativeFileSet are skipped, making the complete application missing .... :(

The real difference here is, that considering some SUBFOLDER not being created ... lets say "lib" .... makes the whole thing explode. Sorry if this hurts your feelings but ... what moron.....

@FibreFoX
Copy link
Member Author

FibreFoX commented Jan 28, 2018

After digging into it, there is a huge problem within the JDK and the bundlers: they are deleting anything before bundling. Makes it a clean solution, but makes it impossible to pre-create the required folders...

File doBundle(Map<String, ? super Object> p, File outputDirectory, boolean dependentTask) {
// ...
IOUtils.deleteRecursive
// ...
}

This requires to be reported ... and no JDK 9 support is possible without some fix from Oracle/OpenJDK/OpenJFX.

EDIT: this is only breaking for Windows-bundlers (and there is no workaround possible ....), but mac- and linux-users seems not affected.

Got this reported: internal review ID : 9052426

@FibreFoX
Copy link
Member Author

FibreFoX commented Feb 1, 2018

http://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8196547

@Aashishkapadiya
Copy link

let me know now how we can build with java 9?

same issue reported me as danielpeintner.

is there anyway to will create build with java 9?

@FibreFoX
Copy link
Member Author

FibreFoX commented Feb 4, 2018

Hi @Aashishkapadiya , as you can see from my last comment on this issue, that building java 9 packages is currently NOT possible with this plugin using windows, because of some bug inside the JDK/javapackager. However, it should be possible using Linux or MacOS(X). I really have to wait for OpenJDK/Oracle-Team having fixed that bug. There is no workaround possible right now, as the target-folder will be deleted recursivly before using inside the javapackager (I hoped to have this working, but it didn't).

@FibreFoX
Copy link
Member Author

FibreFoX commented Feb 9, 2018

@maxd
Copy link
Contributor

maxd commented Mar 2, 2018

@FibreFoX JDK 9 is transitive release with short term of life and looks like JDK 10 will be released this month (see schedule dates).

So, how about close this issue and open new for check compatibility of javafx-maven-plugin with JDK 10? Looks like most of problems described above has been fixed their.

@FibreFoX
Copy link
Member Author

FibreFoX commented Mar 3, 2018

@maxd thanks for the hint for JDK 9 EOL, wasn't sure about this. IMHO this is a real public-relations desaster, maintainers are now forced to make updates more often without proper long-term support.

But anyway, this is the new way, so let me some time to check this against JDK 10+

@FibreFoX
Copy link
Member Author

The current SNAPSHOT-version respects JDK 9 + 10.

@FibreFoX FibreFoX changed the title Support for current JDK 9 Support for current JDK 9 and JDK 10 Mar 21, 2018
@FibreFoX FibreFoX removed this from the v8.9.0 milestone Mar 30, 2018
@ctipper
Copy link

ctipper commented May 3, 2018

I'm a little out of date but as I recall my issue with JDK 9 was not being able to mvn jfx:run is that possible now with the current release 8.8.3? Because if you can't do that you can't test, and if you can't test you can't deploy. I know I'm being obtuse but it seems that this issue has been live for over 12 months now and most the replies refer to deployment, which to me is secondary, I may never even release my code base at this rate. I should note before I get shouted at that I have other concerns being able to --add-opens and such, but I can not debug and am stuck on JDK 8.

@FibreFoX
Copy link
Member Author

FibreFoX commented May 3, 2018

Thanks for the rant @ctipper , which isn't that helping, but maybe you might have looked into the progress of JDK9 and JDK10+, where the future of JavaFX and javapackager has changed A LOT. Starting with JDK11/12 it is uncertain, if javapackager still be inside the provided JDK by oracle.

This open-source project is open for your own customizations, so if you really had the urge to "make it built", why didn't you fork and use it? Have you even tried the available SNAPSHOT-version?

Meanwhile, while having my first days at a new job right now, my progress on the distribution-bundle-plugin-for-maven is a bit cold, but will get some progress the next days, which is kinda some lessons-learned and "reducing dependency to javapackager". You can read my position to the whole project here: FibreFoX/javafx-gradle-plugin#119

@ctipper
Copy link

ctipper commented May 3, 2018

Yes Yes and yes. I have tried all your suggestions with no success. I am sure packaging is very useful, but solve one problem at a time, I can't even run anything to see if it works.

@FibreFoX
Copy link
Member Author

FibreFoX commented May 3, 2018

First of all jfx:run is merely a "shortcut" which wasn't that clever to create in the first place, because it does not work at intended, even worse is used without the understanding of what is happening. This just launches your application within a separate JVM. To have it "working", just run your application via normal CLI.
Second: maybe I wasn't clear enough: there is no future of the javafx-maven-plugin, because it's a wrapper around the javapackager itself. As the resources got closed (the jdk9-module is not open enough for me, as I need some more classes than the jdk allows me to access), there will not be any real working plugin which is having the same featurelist than with JDK8. If the missing visible progress on this plugin is stopping you from production, please try to workaround this by manually using ANT within your maven-project (maven-ant-runner or any other replacement).

EDIT: This does not mean that this plugin is discontinued for JDK 8, but as I'm out of available free time (still some spare-time project for me), and I'm not getting paid for doing this, please try to understand.

@ctipper
Copy link

ctipper commented May 3, 2018 via email

@cbm64chris
Copy link

Working great on JDK10, I had some issues with JDK9 but since that is out of support I am not worried about that.

Question though; how can I include the Java executable in Java.runtime/Contents/Home/bin?

@arman-sydikov
Copy link

arman-sydikov commented Jun 17, 2018

Confirm that it works with jdk 10 when I set --module-path to explicit modules target/classes.
But when I set --module-path to automatic modules target/demo-0.0.1-SNAPSHOT.jarit throws a NullPointerException. What am I doing wrong ? Is it because of JLink doesn't work with automatic modules ?
Automatic modules only work as jars, so I built a non-executable jar for the app, instead of using target/classes. I have created a test application for this issue - https://github.com/algakzru/javafx-jdk-10

@alien0matic
Copy link

javafx-maven-plugin is giving me a hard time transferring our JavaFX application to Java 10.
I added the 8.9.0-SNAPSHOT Plugin, but when I do this mvn clean verify -P myProfile jfx:native I get an error:
No plugin found for prefix 'jfx' in the current project and in the plugin groups

@vadimPT
Copy link

vadimPT commented Sep 12, 2018

We are using this plugin for a while and it worked great for us with Java 8. Thanks for your work indeed!

Recently, we have decided to move to Java 10 and I am trying to migrate the build but without success so far. I am using 8.9.0-SNAPSHOT., Oracle JSDK 10.0.2 64-bit. Maybe you can give me some hints.

I am building for Windows 10 on the same OS and this is what I am getting.

Warning: Windows Defender may prevent the Java Packager from functioning. If there is an issue, it can be addressed by either disabling realtime monitoring, or adding an exclusion for the directory "C:\Users\user\AppData\Local\Temp\". java.io.IOException: Exec failed with code 2 command [[C:\bin\InnoSetup5\iscc.exe, /oC:\Users\user\workspace\jfx-launchpad\target\jfx\native, C:\Users\user\AppData\Local\Temp\fxbundler8054117485247878050\images\win-exe.image\P T algos.iss] in C:\Users\user\AppData\Local\Temp\fxbundler8054117485247878050\images\win-exe.image at jdk.packager/com.oracle.tools.packager.IOUtils.exec(IOUtils.java:215) at jdk.packager/com.oracle.tools.packager.IOUtils.exec(IOUtils.java:188) at jdk.packager/com.oracle.tools.packager.IOUtils.exec(IOUtils.java:182) at jdk.packager/com.oracle.tools.packager.windows.WinExeBundler.buildEXE(WinExeBundler.java:704) at jdk.packager/com.oracle.tools.packager.windows.WinExeBundler.bundle(WinExeBundler.java:372) at jdk.packager/com.oracle.tools.packager.windows.WinExeBundler.execute(WinExeBundler.java:174) at com.zenjava.javafx.maven.plugin.NativeMojo.execute(NativeMojo.java:734) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:954) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) at org.apache.maven.cli.MavenCli.main(MavenCli.java:192) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

Any ideas what can be an issue here and how it can be solved?

@garzy
Copy link

garzy commented Jun 27, 2019

javafx-maven-plugin is giving me a hard time transferring our JavaFX application to Java 10.
I added the 8.9.0-SNAPSHOT Plugin, but when I do this mvn clean verify -P myProfile jfx:native I get an error:
No plugin found for prefix 'jfx' in the current project and in the plugin groups

You must follow the SNAPSHOP repository prerequisite as explained on top :)

<pluginRepositories>
    <pluginRepository>
        <id>oss-sonatype-snapshots</id>
        <url>https://oss.sonatype.org/content/groups/public/</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </pluginRepository>
</pluginRepositories>

@garzy
Copy link

garzy commented Jun 27, 2019

Currently, with the latest SNAPSHOP and openjfx 11 and openjdk 11 the plugin doesn't work due it's calling an unexistent class that has been removed from the openjdk 11 release (IMO):

[WARNING] Error injecting: com.zenjava.javafx.maven.plugin.CliJarMojo
java.lang.NoClassDefFoundError: com/sun/javafx/tools/packager/PackagerException

@FibreFoX
Copy link
Member Author

This plugin currently just works for JDK 8 ... :( and I really hate the situation as it is ... (not that people do complain, but more like me finding not much time anymore ... it used to be fun to work on this spare-time-project)

@garzy
Copy link

garzy commented Jun 27, 2019

OK, I understand you, don't worry and thanks for your very fast answer :)

For now, I will use the official openjfx maven plugin but's it only generates .jar executable, doesn't generate native exe (or I don't know how) :(

Thanks!!, awesome work!, maybe in the future I'll have time to help you with a pull request ;)

@FibreFoX FibreFoX removed the JDK 10 label Aug 10, 2021
@FibreFoX FibreFoX changed the title Support for current JDK 9 and JDK 10 Support for current JDK 9, JDK 10, JDK 11, JDK 12, JDK 13, JDK 14, JDK 15, JDK 16 ... Aug 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests