JavaPackager icon indicating copy to clipboard operation
JavaPackager copied to clipboard

Packaging app on Apple Silicon won't run without Rosetta

Open wheelerlaw opened this issue 2 years ago • 4 comments

I'm submitting a…

  • [x] bug report
  • [ ] feature request
  • [ ] other

Short description of the issue/suggestion:

When I try to run an app that I packaged on a Mac with Apple silicon, the app will not run unless Rosetta is installed.

Steps to reproduce the issue/enhancement:

  1. Make sure Rosetta is not installed on your system
  2. Clone this repo: https://github.com/SteelecoSystems/sample-native-app
  3. Run mvn package
  4. Go into Finder, and try to run the app, and it should show the popup asking to install Rosetta.

What is the expected behavior?

It should not ask to install Rosetta, as I have a JDK installed that is universal. If I manually run the jar using the JDK that gets bundled with the Mac app, it runs fine:

./target/sample-native-app/sample-native-app.app/Contents/PlugIns/jre.jre/Contents/Home/bin/java -jar ./target/sample-native-app/sample-native-app.app/Contents/Resources/Java/sample-native-app-1.0-SNAPSHOT-runnable.jar

What is the current behavior?

A popup appears asking for Rosetta to be installed.

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

I can produce one if you are unable to reproduce the issue.

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

If the Java Runtime running the Jar directly doesn't need Rosetta, then what else is happening with the App that requires it to be installed?

Please tell us about your environment:

  • JavaPackager version: 1.7.5
  • OS version: macOS Sonoma 14.2.1
  • JDK version: 21.0.1 (installed through Homebrew)
  • Build tool:
    • [x] Maven
    • [ ] Gradle

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

wheelerlaw avatar Jan 19 '24 21:01 wheelerlaw

Hi @wheelerlaw! Sorry for my late reply. How are you setting macConfig.macStartup property?

fvarrui avatar Feb 23 '24 12:02 fvarrui

Ok, I've just seen ... sorry, missed the link to your demo app:

https://github.com/SteelecoSystems/sample-native-app/blob/fd9cd385c83edb622f6f19226ef8315613b1a97b/pom.xml#L1-L52

Please, try setting macConfig.macStartup=SCRIPT (so, it will use the non-compiled version of universalJavaApplicationStub, which is just a BASH script) ... If this way works fine, maybe could be a problem with the UNIVERSAL version of universalJavaApplicationStub

fvarrui avatar Feb 25 '24 21:02 fvarrui

I'm not sure if using a compiled version of the startup script (universalJavaApplicationStub) is worth ... in theory the app should start faster with a compiled version, but I haven't test this.

fvarrui avatar Feb 25 '24 21:02 fvarrui

Any news?

fvarrui avatar Jun 30 '24 15:06 fvarrui