jpackage does not include extra files from app-image when creating Debian package?

Tobias Oelgarte tobias.oelgarte at gmail.com
Sat Feb 27 11:51:05 UTC 2021


On 27.02.21 11:22, Michael Hall wrote:
>
>> On Feb 27, 2021, at 1:31 AM, Tobias Oelgarte <tobias.oelgarte at gmail.com> wrote:
>>
>>> No, there is no platform independent and reliable way to get the path to 'app' directory. However you can get location of one of your app's classes through Class.getResource(). See https://stackoverflow.com/questions/227486/find-where-java-class-is-loaded-from <https://stackoverflow.com/questions/227486/find-where-java-class-is-loaded-from>
>> That isn't helpful at all. All i get is either the URL jrt:/<modulename> or null, but not the installation directory or something similar.
> System property? java.home, java.launcher.path, java.library.path, java.class.path
>
> My application indicates a security policy…
> -Djava.security.policy=$APPDIR/all.policy
>
> Which actually gets you into the app directory.
> -Djava.security.policy=$APPDIR/all.policy
>
> On virtual box Windows showing...
> C:\Program Files\HalfPipe\app/all.policy

java.home points to the runtime directory, which is fine, but it is 
placed differently on Windows and Linux. In Windows it is 
'AppName/runtime' with app directory 'AppName/app' and under Linux it is 
'AppName/lib/runtime' with app directory 'AppName/app'. So i have to 
query the operating system first, before deciding where the 'app' 
directory would be. Additionally i can't create a *.deb including the 
app folder, because jpackage fails to include the app directory.

java.launcher.path is not available under Linux with JDK 16. Instead i 
would have to use jpackage.app-path.

java.library.path is a list of paths pointing outside of the application 
directory. For example: 
'/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib'

java.class.path is empty in case of a modular application.

Using a security policy file is also an awkward way, to only get the app 
directory. But at least it is doable.



More information about the jdk-dev mailing list