javanetbeansjavafxantjavapackager

Javapackager deploy IOException on second time


i noticed that i can not deploy a JavaFX application with javapackager two times without closing the IDE / commandline. I want to create a native image of my application on a Windows 10 machine.

After the second deploy I get Exception: java.io.IOException: Access denied. After closing and reopen it works for one deploy again.

I can reproduce this Issue with Netbeans (create a JavaFX Application, enable Native Packaging, and then package as "image only") on 3 different PCs with Oracle JDK 8u121 and Windows 10. I also get this error in a gradle project in eclipse trying to deploy it with the official ant task (https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/javafx_ant_tasks.html)

Also tried it on an Ubuntu VM and OpenJDK. There is no problem.

Can somebody of you reproduce this error on Windows 10, too? Is there a workaround or offical bug report for this?

Thanks in advance Joey


Solution

  • This is a known problem, the cause is a file-handle leak and already got reported by me: https://bugs.openjdk.java.net/browse/JDK-8148717 It is only windows-specific, as the file-locking on the JRE-folder works on windows-systems, other OS don't lock.

    This bug got worked around inside the JavaFX-Gradle-Plugin, as gradle starts daemons, which hold up the JVM, the JavaFX-Maven-Plugin didn't need it, because the JVM is always closed.

    Disclaimer: I'm the creator of the JavaFX-Gradle-Plugin and maintainer of the JavaFX-Maven-Plugin.