jpackage --type app-image creates infinite recursive directories

风流意气都作罢 提交于 2021-01-05 12:45:29

问题


I'm trying to use jpackage to create an installer for my Java app. I'm on Windows 10 using OpenJDK 15.0.1. I can build an installer using

jpackage --input C:\MyApp --main-jar MyApp.jar

This basically works, but the installed application lacks resource files. According to the documentation, I should be able to build an app image, add my resource files to the image, then build the installer from the modified app image, as follows

jpackage --type app-image -n MyAppImage
copy <resource files> MyAppImage
jpackage --app-image MyAppImage --name MyAppInstaller

However, when I try jpackage --type app-image the process never terminates, and I have to kill it with control-C. When I examine the MyAppImage directory, it has a subdirectory app, which more or less mirrors the contents of C:\MyApp. Those contents include MyAppImage, which recursively gets copied into the app subdirectory, creating a potentially infinite set of directories: C:\MyApp\MyAppImage\app\MyAppImage\app\MyAppImage ...

If I manually delete app\MyAppImage and try jpackage --app-image, jpackage crashes with a java.io.IOException.

Has anyone else encountered this? What should I try?


回答1:


It turns out that the shell working directory makes a difference. The directory specified by --input should not be the same as the directory where the app image will be created.

I fixed the problem by creating a subdirectory C:\MyApp\build and copying MyApp.jar to build.

cd C:\MyApp
mkdir build
copy MyApp.jar build
jpackage --type app-image --n MyAppImage --input C:\MyApp\build --main-jar MyApp.jar

The recursive file-copying doesn't happen any more. But I'm still getting an error when running jpackage --app-image. I'll make that the subject of a subsequent post.



来源:https://stackoverflow.com/questions/64741275/jpackage-type-app-image-creates-infinite-recursive-directories

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!