fvarrui / JavaPackager

:package: Gradle/Maven plugin to package Java applications as native Windows, MacOS, or Linux executables and create installers for them.
GNU General Public License v3.0
1.07k stars 133 forks source link

Library not loaded #218

Closed kerner1000 closed 2 years ago

kerner1000 commented 2 years ago

I'm submitting a…

Short description of the issue/suggestion:

When starting my mac app, a crash report opens which says

Termination Reason:    Namespace DYLD, Code 1 Library missing
Library not loaded: @rpath/libjli.dylib"

Steps to reproduce the issue/enhancement:

  1. Package the app, mvn package
  2. Install the app from the generated dmg
  3. Launch the app

What is the expected behavior?

App starts normally.

What is the current behavior?

App crashes.

Do you have outputs, screenshots, demos or samples which demonstrate the problem or enhancement?

Termination Reason:    Namespace DYLD, Code 1 Library missing
Library not loaded: @rpath/libjli.dylib
Referenced from: /Applications/myApp.app/Contents/PlugIns/jre/Contents/Home/bin/java
Reason: tried: '/Applications/myApp.app/Contents/PlugIns/jre/Contents/Home/bin/./libjli.dylib' (no such file), '/Applications/myApp.app/Contents/PlugIns/jre/Contents/Home/bin/../lib/libjli.dylib' (code signature in <FFEF7E24-D9E6-31F6-8FC2-51C4A63439D4> '/Applications/myApp.app/Contents/PlugIns/jre/Contents/Home/lib/libjli.dylib' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)), '/Applications/myApp.app/Contents/PlugIns/jre/Contents/Home/bin/./libjli.dylib' (no such file), '/Applications/myApp.app/Contents/PlugIns/jre/Contents/Home/bin/../lib/libjli.dylib' (code signature in <FFEF7E24-D9E6-31F6-8FC2-51C4A63439D4> '/Applications/myApp.app/Contents/PlugIns/jre/Contents/Home/lib/libjli.dylib' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed wi
(terminated at launch; ignore backtrace)

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

java -version
openjdk version "18.0.1" 2022-04-19
OpenJDK Runtime Environment Temurin-18.0.1+10 (build 18.0.1+10)
OpenJDK 64-Bit Server VM Temurin-18.0.1+10 (build 18.0.1+10, mixed mode)
sw_vers
ProductName:    macOS
ProductVersion: 12.4
BuildVersion:   21F79

Other information (e.g. related issues, suggestions how to fix, links for us to have context)

fvarrui commented 2 years ago

Hi @kerner1000! This problem is because your app needs entitlements. You should provide an entitlements.plist file using macConfig.entitlements property needed when signing the app, or use the new devel version. Just pull JavaPackager (as in issue 217) and install again into your local repo. This new version generates a default entitlements file and use it when signing the app.

fvarrui commented 2 years ago

Entitlements are the permissions that your app needs from the OS in order to run.

fvarrui commented 2 years ago

Hi @kerner1000! This problem is because your app needs entitlements. You should provide an entitlements.plist file using macConfig.entitlements property needed when signing the app, or use the new devel version. Just pull JavaPackager (as in issue 217) and install again into your local repo. This new version generates a default entitlements file and use it when signing the app.

And sorry! This problem was fixed in issue-187 but I forgot to merge these changes into devel. I've been a bit busy last months 😢

kerner1000 commented 2 years ago

It works, thanks! :)

fvarrui commented 2 years ago

Great, thanks!!