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

fix: startup warning if _JAVA_OPTIONS is set #214

Merged
merged 1 commit into from
Jan 25, 2025

Conversation

Vinfall
Copy link

@Vinfall Vinfall commented Jan 24, 2025

I have _JAVA_OPTIONS set in my environment and this is causing problem when checking Java versions. This PR solves the issue by filtering out this info in java -version output.

# .profile
export _JAVA_OPTIONS="-Djavafx.cachedir=$XDG_CACHE_HOME/openjfx"

With above settings, the output is problematic even if you use sed:

$ java -version
Picked up _JAVA_OPTIONS: -Djavafx.cachedir=/home/user/.cache/openjfx
openjdk version "21.0.6" 2025-01-21
OpenJDK Runtime Environment (build 21.0.6+1-void-r1)
OpenJDK 64-Bit Server VM (build 21.0.6+1-void-r1, mixed mode, sharing)

Warning message (the program itself runs fine though):

$ cd blahblah/to/ffdec
$ ./ffdec.sh
./ffdec.sh: line 47: [: Picked up _JAVA_OPTIONS: -Djavafx.cachedir=/home/user/.cache/openjfx 21: integer expression expected
./ffdec.sh: line 49: [: Picked up _JAVA_OPTIONS: -Djavafx.cachedir=/home/user/.cache/openjfx 21: integer expression expected
./ffdec.sh: line 53: [: Picked up _JAVA_OPTIONS: -Djavafx.cachedir=/home/user/.cache/openjfx 0: integer expression expected
./ffdec.sh: line 55: [: Picked up _JAVA_OPTIONS: -Djavafx.cachedir=/home/user/.cache/openjfx 0: integer expression expected
./ffdec.sh: line 59: [: Picked up _JAVA_OPTIONS: -Djavafx.cachedir=/home/user/.cache/openjfx 6: integer expression expected
./ffdec.sh: line 61: [: Picked up _JAVA_OPTIONS: -Djavafx.cachedir=/home/user/.cache/openjfx 6: integer expression expected
./ffdec.sh: line 65: [: Picked up _JAVA_OPTIONS: -Djavafx.cachedir=/home/user/.cache/openjfx : integer expression expected
Picked up _JAVA_OPTIONS: -Djavafx.cachedir=/home/user/.cache/openjfx

Only tested on Void Linux with OpenJDK21 installed.

@jindrapetrik jindrapetrik changed the base branch from master to dev January 25, 2025 08:30
@jindrapetrik jindrapetrik merged commit 8999522 into jindrapetrik:dev Jan 25, 2025
2 checks passed
@jindrapetrik
Copy link
Owner

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants