Closed kerner1000 closed 2 years ago
Hi @kerner1000! Please, could you share you plugin configuration? I'll try to reproduce your issue and find out what is happening.
Or if you have a testing app
Hi @fvarrui , thank you!
<plugin>
<groupId>io.github.fvarrui</groupId>
<artifactId>javapackager</artifactId>
<version>1.6.7-SNAPSHOT</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>package</goal>
</goals>
<configuration>
<!-- mandatory -->
<mainClass>${main-class}</mainClass>
<!-- optional -->
<bundleJre>true</bundleJre>
<jrePath>src/main/resources/jdk/temurin-18.jdk/Contents/Home</jrePath>
<generateInstaller>true</generateInstaller>
<administratorRequired>false</administratorRequired>
<platform>mac</platform>
<name>MyApp</name>
<assetsDir>src/main/resources/assets</assetsDir>
<organizationEmail>support@MyApp.app</organizationEmail>
<organizationUrl>https://MyApp.app</organizationUrl>
<url>https://MyApp.app</url>
<version>1.0.11</version>
<macConfig>
<entitlements>src/main/resources/assets/mac/entitlements.plist</entitlements>
<!-- <macStartup>UNIVERSAL</macStartup>-->
<developerId>3rd Party Mac Developer Application: Max Mustermann (6W37Y2F3CM)</developerId>
<appId>com.MyApp</appId>
<provisionProfile>src/main/resources/assets/mac/MyApp.provisionprofile</provisionProfile>
<codesignApp>true</codesignApp>
<!-- properties used for Info.plist file generation -->
<infoPlist>
<bundlePackageType>APPL</bundlePackageType>
<additionalEntries>
<![CDATA[
<key>LSApplicationCategoryType</key>
<string>public.app-category.productivity</string>
<key>LSMinimumSystemVersion</key>
<string>10.4</string>
]]>
</additionalEntries>
</infoPlist>
</macConfig>
</configuration>
</execution>
</executions>
</plugin>
Please find the example app here:
Cool, thanks!
One thing: you are bundling a JDK with your app. Why don't you bundle a JRE instead of a JDK? Your app would be lighter.
Thanks, I will do it! It really is quite big...
Sorry, I can test your app ... it's built for aarch64 CPU architecture! ... I'm using a virtualized macOS on my laptop (x64) 😢
Oh, right! Can I bundle a multi arch for both architectures?
Yes, I think so. Set macConfig.macStartup=SCRIPT|UNIVERSAL
and bundle a x64 JRE using jrePath
property.
I will try that!
I'm afraid there's a problem in the universalJavaApplicationStub
script relocating the JAR file... this was a change introduced in 1.6.7 because before JavaPackager modified the script during its execution, and the idea now was that the script reads the property RelocateJar
of the Info.plist
file to modify its behavior (instead of tuning it) ... I've tested and it was working fine, but maybe I miss something.
Building/ Packaging, signing and even validation for the App Store work well with this setup, thanks! Unfortunately, the app crashes at start.
default 21:12:10.295474+0200 secinitd universalJavaApplicationStub[44738]: root path for bundle "<private>" of main executable "<private>"
default 21:12:10.306299+0200 secinitd universalJavaApplicationStub[44738]: AppSandbox request successful
default 21:12:10.308446+0200 universalJavaApplicationStub Requesting container lookup; personaid = -1, type = NOPERSONA, name = <unknown>, class = 2, identifier = <private>, temp = 0, create = 0, euid = 501, uid = 501
default 21:12:10.310535+0200 universalJavaApplicationStub container_create_or_lookup_for_platform: success
default 21:12:10.324736+0200 secinitd universalJavaApplicationStub[44738]: root path for bundle "<private>" of main executable "<private>"
default 21:12:10.339086+0200 secinitd universalJavaApplicationStub[44738]: AppSandbox request successful
default 21:12:10.340224+0200 kernel AMFI: Denying core dump for pid 44738 (universalJavaApp)
default 21:12:10.340275+0200 kernel universalJavaApplicationStub[44738] Corpse allowed 1 of 5
error 21:12:10.378138+0200 sandboxd Failed to produce a full report for: universalJavaApp[44738].
error 21:12:10.378319+0200 sandboxd Sandbox: universalJavaApp(44738) deny(1) forbidden-sandbox-reinit
default 21:12:10.422043+0200 ReportCrash Formulating fatal 309 report for corpse[44738] universalJavaApplicationStub
Please, try to run universalJavaApplicationStub
directly from the command line and send me the output
How can I do that? 🙈
Try ./MyApp.app/Contents/MacOS/universalJavaApplicationStub
yes, that gives me
/Applications % MyApp.app/Contents/MacOS/universalJavaApplicationStub
MyApp.app/Contents/MacOS/universalJavaApplicationStub: /Users/alex/Library/Containers/com.myapp/Data/MyApp.app/Contents/MacOS/universalJavaApplicationStub: No such file or directory
MyApp.app/Contents/MacOS/universalJavaApplicationStub: line 0: exec: /Users/alex/Library/Containers/com.myapp/Data/MyApp.app/Contents/MacOS/universalJavaApplicationStub: cannot execute: No such file or directory
I was wondering from where the "Containers" path is coming from. Probably the app is put into it's own container env. (no idea how this is communicated to the universalJavaApplicationStub
exe.
Maybe it makes sense to you, but there is a folder named "DrRename" (the app name) but the universalJavaApplicationStub
is looking for a directory named by the bundle-id/ app-identifier (com.drrename).
When I solve one problem, another one pops up 😂
Went back to the beginning and I am bundling without a JRE to exclude any error coming from this side.
if I use <macStartup>UNIVERSAL</macStartup>
, or ARM64
, or X86_64
I can package, sign and validate without errors, but I get the file not found exception
mentioned above when I try to start the app.
If I omit this (and use the default, which is SCRIPT), then the app starts as expected but gives me an App Store validation error:
{
NSLocalizedDescription = "Bad Bundle Executable. You must include a valid CFBundleExecutable key in your bundle's information property list file. With error code STATE_ERROR.VALIDATION_ERROR.90259 for id a1cfb2fb-b0cc-455f-8fb3-76df6df46c24";
NSLocalizedFailureReason = "Asset validation failed";
}
This is quite funny, since in the second case the executable actually runs, in contrast to the first setup ;)
Ah, yes, and of course the CFBundleExecutable
element is present in the Info.plist
.
Thanks for helping!
When I solve one problem, another one pops up 😂
😄
[]
Went back to the beginning and I am bundling without a JRE to exclude any error coming from this side.
if I use
<macStartup>UNIVERSAL</macStartup>
, orARM64
, orX86_64
I can package, sign and validate without errors, but I get thefile not found exception
mentioned above when I try to start the app.If I omit this (and use the default, which is SCRIPT), then the app starts as expected but gives me an App Store validation error:
{ NSLocalizedDescription = "Bad Bundle Executable. You must include a valid CFBundleExecutable key in your bundle's information property list file. With error code STATE_ERROR.VALIDATION_ERROR.90259 for id a1cfb2fb-b0cc-455f-8fb3-76df6df46c24"; NSLocalizedFailureReason = "Asset validation failed"; }
This is quite funny, since in the second case the executable actually runs, in contrast to the first setup ;)
Ah, yes, and of course the
CFBundleExecutable
element is present in theInfo.plist
.Thanks for helping!
Sorry, I don't know how to help you 😞 ... I labeled this issue as "help wanted", maybe someone can help us.
Have you tried to run the generated app in target
instead of run the installed PKG file?
Thanks @fvarrui I found out, that codesign
is somehow making the binary executable unusable. Trying to find out why and how to resolve..
I close here with a reference to a more precisely specified issue ;) https://github.com/tofi86/universalJavaApplicationStub/issues/124
I'm submitting a…
Short description of the issue/suggestion:
My bundled app fails to start. I took a look at the Logs, there I see
universalJavaApplicationStub
log:[EXEC] "/Applications/MyApp.app/Contents/PlugIns/jre/Contents/Home/bin/java" -cp ".:Java/MyApp-1.0.11-runnable.jar" -Xdock:icon="/Applications/MyApp.app/Contents/Resources/MyApp.icns" -Xdock:name="MyApp" com.kerner1000.myapp.Launcher
When I try to manually invoke, I get the following error:
When I extract
MyApp-1.0.11-runnable.jar
, I can find the class inside, so it is there. I don't know why it cannot be loaded.Now, when I try the following, it works:
"/Applications/MyApp.app/Contents/PlugIns/jre/Contents/Home/bin/java" -cp "/Applications/MyApp.app/Contents/Resources/Java/MyApp-1.0.11-runnable.jar" -Xdock:icon="/Applications/MyApp.app/Contents/Resources/MyApp.icns" -Xdock:name="MyApp" com.kerner1000.myapp.Launcher
Note the absolute path for the classpath argument.
Do it need to specify the classpath or is this a bug when using a custom JRE?