tobain
tobain

Reputation: 666

Javapackager - NoSuchFileException while copying libraries JDK 9

When I use the javapacker command, I get a NoSuchFileException when it should copy the libraries to the app folder. I'm running the following command:

javapackager -deploy -nosign -v -native image -name test 
-appclass test.Test 
-srcdir "E:\projects\test\target"
-srcfiles test-1.0.jar;lib
-outdir "E:\projects\test\target\dist"

Anything seams to work fine, but i get the NoSuchFileException inside the output and the libraries inside the lib folder are missing (did not get copied).

Running [D:\Java64\jdk-9.0.4\bin\java.exe, -version]
Creating app bundle: test in E:\projects\test\target\dist
"Adding modules: [java.rmi, java.sql, javafx.web, ... long list ... 
outputDir = E:\projects\test\target\dist\test\runtime
modulePath = [D:\Java64\jdk-9.0.4\jmods]
addModules = [java.rmi, java.sql, javafx.web, ... long list ...
limitModules = []
excludeFileList = .*\.diz
stripNativeCommands = true
userArguments = {}
Using default package resource [icon]  (add package/windows/test.ico to the class path to customize)
Using default package resource [Template for creating executable properties file.]  (add package/windows\test.properties to the class path to customize)
Running [D:\Java64\jdk-9.0.4\bin\javapackager.exe, --icon-swap, C:\Users\XXX\AppData\Local\Temp\fxbundler15945263774290817340\windows\test.ico, E:\projects\test\target\dist\test\test.exe]
Icon File Name: C:\Users\XXX\AppData\Local\Temp\fxbundler15945263774290817340\windows\test.ico
Executable File Name: E:\projects\test\target\dist\test\test.exe
Running [D:\Java64\jdk-9.0.4\bin\javapackager.exe, --version-swap, C:\Users\XXX\AppData\Local\Temp\fxbundler15945263774290817340\windows\test.properties, E:\projects\test\target\dist\test\test.exe]
Resource File Name: C:\Users\XXX\AppData\Local\Temp\fxbundler15945263774290817340\windows\test.properties
Executable File Name: E:\projects\test\target\dist\test\test.exe
Exception: java.nio.file.NoSuchFileException: E:\projects\test\target\lib\animal-sniffer-annotations-1.14.jar -> E:\projects\test\target\dist\test\app\lib\animal-sniffer-annotations-1.14.jar
Config files are saved to C:\Users\XXX\AppData\Local\Temp\fxbundler15945263774290817340\windows. Use them to customize package.
Result application bundle: E:\projects\test\target\dist

I don't know what the following line of the output is trying to tell me. The file clearly exists inside my lib folder and the javapackager did find it itself by looking inside the lib folder, that I provided with the -srcfiles test-1.0.jar;lib argument.

Exception: java.nio.file.NoSuchFileException: E:\projects\test\target\lib\animal-sniffer-annotations-1.14.jar -> E:\projects\test\target\dist\test\app\lib\animal-sniffer-annotations-1.14.jar

Any idea why javapacker complains that the file would not exist?

Upvotes: 1

Views: 654

Answers (1)

robot_rover
robot_rover

Reputation: 130

As per https://docs.oracle.com/javase/9/tools/javapackager.htm#JSWOR719, -srcfiles should be provided with a list of files. lib is a directory. I would try using -srcdir.

Also, if you get

Exception: java.lang.Exception: Error: Modules are not allowed in srcfiles

it means you have to use --module-path, and then set the main module using -m <module name>

Upvotes: -2

Related Questions