• 14

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'
exec java.real -Dsun.java2d.opengl=true "$@"
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.

  • 0
Reply Report
    • It's not clear to me that there is a distribution-agnostic way to say "replace this package-controlled file with an arbitrary different one", nor even that any given distribution will have such a method at all. If the question had been specific to a given distribution, or even mentioned one, it might have been worth researching its specific mechanism.
      • 1
    • It doesn't need to be agnostic (but $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.

Warm tip !!!

This article is reproduced from Stack Exchange / Stack Overflow, please click

Trending Tags

Related Questions