Modify

Opened 7 weeks ago

#24551 new enhancement

[PATCH] Use grep -i version instead of head -n1 in linux launch script

Reported by: Revnoplex <revnoplex.business@…> Owned by: team
Priority: normal Milestone:
Component: Core Version:
Keywords: Linux Cc: revnoplex.business@…

Description

Hi, I have a suggestion that the snippet used to determine the current java version on the system in the linux launch script be changed to used grep -i version instead of head -n1 in the java_version function on line 43 of the linux launch script:

${1} -version 2>&1 | head -n1 | awk -F'"' '{print $2}' | awk -F'.' '{print $1}'

I am suggesting this because when the environmental variable JDK_JAVA_OPTIONS is set, the first thing the java -version command prints instead of the version line:

NOTE: Picked up JDK_JAVA_OPTIONS: -Dsun.java2d.uiScale=2 -Dglass.gtk.uiScale=170%

And that causes the version function to fail which then causes this condition:

if [[ "${JAVA_VERSION}" -ge 11 ]]; then

to fail which leaves out

JAVA_OPTS="$JAVA_OPTS --add-exports=java.base/sun.security.action=ALL-UNNAMED"
JAVA_OPTS="$JAVA_OPTS --add-exports=java.desktop/com.sun.imageio.plugins.jpeg=ALL-UNNAMED"
JAVA_OPTS="$JAVA_OPTS --add-exports=java.desktop/com.sun.imageio.spi=ALL-UNNAMED"

Which then JOSM complains about on launch:

Missing JVM Arguments: 
--add-exports=java.base/sun.security.action=ALL-UNNAMED 
--add-exports=java.desktop/com.sun.imageio.plugins.jpeg=ALL-UNNAMED 
--add-exports=java.desktop/com.sun.imageio.spi=ALL-UNNAMED 
These arguments should be added in the command line or start script before the -jar parameter.

My proposal is to use grep -i version to get the correct line
as suggested by https://stackoverflow.com/a/27339694

Attachments (2)

24551.diff (979 bytes ) - added by Revnoplex <revnoplex.business@…> 7 weeks ago.
Screenshot_20251123_214812.png (83.5 KB ) - added by Revnoplex <revnoplex.business@…> 7 weeks ago.

Download all attachments as: .zip

Change History (2)

by Revnoplex <revnoplex.business@…>, 7 weeks ago

Attachment: 24551.diff added

by Revnoplex <revnoplex.business@…>, 7 weeks ago

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain team.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from team to the specified user.
Next status will be 'needinfo'. The owner will be changed from team to Revnoplex <revnoplex.business@…>.
as duplicate The resolution will be set to duplicate. Next status will be 'closed'. The specified ticket will be cross-referenced with this ticket.
The owner will be changed from team to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.