﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
24551	[PATCH] Use grep -i version instead of head -n1 in linux launch script	Revnoplex <revnoplex.business@…>	team	"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
"	enhancement	new	normal		Core			Linux	revnoplex.business@…
