Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jvm options in ${name}.l4j.ini are not recognized on macOS #335

Closed
2 of 5 tasks
kia opened this issue May 30, 2023 · 10 comments
Closed
2 of 5 tasks

jvm options in ${name}.l4j.ini are not recognized on macOS #335

kia opened this issue May 30, 2023 · 10 comments
Labels
bug Something isn't working fixed Issue fixed and release pending merged Changes merged into devel branch

Comments

@kia
Copy link

kia commented May 30, 2023

I'm submitting a…

  • bug report
  • feature request
  • other

Short description:
the jvm options in ${name}.l4j.ini are not recognized on macOS:

Steps to reproduce the issue/enhancement:

  1. [First Step]
    take this source code as an example

java-packager-example.zip

  1. unzip and run mvn clean package
  2. start the created application:
    target/deploy/java-packager-example/java-packager-example

What is the expected behavior?
output:
hello.world: HelloWorld

What is the current behavior?
on Linux as above but on Mac

hello.world: null

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

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

Please tell us about your environment:

  • JavaPackager version: 1.7.2
  • OS version: macOS 10.15.7
  • JDK version: 19.0.2
  • Build tool:
    • Maven
    • Gradle

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

@fvarrui fvarrui added working on Work in progress on this issue bug Something isn't working labels Jun 1, 2023
@fvarrui
Copy link
Owner

fvarrui commented Jun 1, 2023

Hi @kia!
I think I just found the error.

The universalJavaApplicationStub startup script reads the JVMOptionsFile key from the Info.plist file:

<key>JVMOptionsFile</key>
<string>$APP_PACKAGE/Contents/Resources/${info.name}.l4j.ini</string>

and stores the value in a variable of the same name ($JVMOptionsFile):

# read options file name
JVMOptionsFile=$(plist_get_java ':JVMOptionsFile')

As can be seen here, the variable $APP_PACKAGE is used, which inside the universalJavaApplicationStub is given the value /full/path/to/My.app (full path to the application directory), assuming that My.app is our application.

The problem is that the $APP_PACKAGE variable is not expanded into the $JVMOptionsFile variable, so it never reads the contents of the l4j.ini file, as it doesn't exist for the script.

# read options file name 
JVMOptionsFile=$(plist_get_java ':JVMOptionsFile') 
JVMOptionsFile=$(eval echo "${JVMOptionsFile}") # I missed this line

I hope I have explained myself! 😅

I am working on it!!!

@fvarrui
Copy link
Owner

fvarrui commented Jun 2, 2023

Ok, just fixed in 1.7.3-20230601.235908-6 (as this is a specific SNAPSHOT version you should read this).

If it works fine for you, this fix will be released in v1.7.3.

@kia
Copy link
Author

kia commented Jun 2, 2023

Hi @fvarrui ,
Thanks for this really quick fix!
I will check it and let you know about the result.

@kia
Copy link
Author

kia commented Jun 2, 2023

Hi @fvarrui ,
The fix worked! Thanks a lot.

best,
Kia

@fvarrui fvarrui added fixed Issue fixed and release pending and removed working on Work in progress on this issue labels Jun 2, 2023
@fvarrui
Copy link
Owner

fvarrui commented Jun 2, 2023

Great 😃

@fvarrui
Copy link
Owner

fvarrui commented Jun 6, 2023

Merged into devel branch, ready to be deployed

@kia
Copy link
Author

kia commented Aug 11, 2023

Hi @fvarrui ,

when would the next release (1.7.3) be available?

thanks,
@kia

@fvarrui fvarrui added the merged Changes merged into devel branch label Aug 11, 2023
@fvarrui
Copy link
Owner

fvarrui commented Aug 11, 2023

1.7.3 released to Maven Central

@fvarrui fvarrui closed this as completed Aug 11, 2023
@kia
Copy link
Author

kia commented Aug 14, 2023

Hi @fvarrui
There is now a new issue. The ${name}-${version}-runnable.jar is not found in deployment directory. In the deployement directory i find ${name}.jar without version and 'runnable'.

Am i missing some configuration details that i have to consider in the new Version?

The very last step during packaging seems to rename the build artifact jar file.
This is the message:

Concatenating files [/target/deploy/linux/assets/startup.sh,/target/deploy/linux/name-version-runnable.jar] into file [/target/deploy/linux/<name>.jar]

best,
Kia

@fvarrui
Copy link
Owner

fvarrui commented Aug 16, 2023

Ok, lets open a new issue for this, and I'll try to reproduce this issue in order to find out what's happening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed Issue fixed and release pending merged Changes merged into devel branch
Projects
None yet
Development

No branches or pull requests

2 participants