I need to add -Dsun.java2d.opengl=true
to my java applications, otherwise they freeze up.
Is there any way to force this system wide, so I don't have to modify the configuration file/script of each java application?
I need to add -Dsun.java2d.opengl=true
to my java applications, otherwise they freeze up.
Is there any way to force this system wide, so I don't have to modify the configuration file/script of each java application?
For a quick and hackish fix, you could do something like:
# type java
java is /usr/bin/java
# mv /usr/bin/java{,.real}
# cat >>/usr/bin/java <<'EOF'
#!/bin/sh
exec java.real -Dsun.java2d.opengl=true "$@"
EOF
chmod +x /usr/bin/java
This replaces your java executable with a shell script that calls the real one, with its given arguments, except with that setting prepended.
$PATH
and your distributions mechanisms.
– Has QUIT--Anony-Mousse
Oct 05 '15 at 23:21
$PATH
is, and Mark mentioned another one). He only has one (unfortunately he didn't both to include which). But the way you propsed will likely be destroyed on the next update.
– Has QUIT--Anony-Mousse
Oct 06 '15 at 06:09
Have you looked at the .properties
files in
/etc/java-8-openjdk
or the equivalent configuration directory of the JVM that you are using?
JAVA_TOOL_OPTIONS
environment variable that is inherited by all processes that may launch your java apps? – Mark Plotnick Oct 06 '15 at 04:41