56

My Java browser plug-in is no longer working. When I open a page that has a Java element, Java cannot connect to the server.

After investigation, I found that Java was trying to use IPv6, while my network does not support IPv6, so Java always fails to connect.

I tried looking on Google and found that I should run Java with -Djava.net.preferIPv4Stack=true, but how can I pass this to the browser?

I use Google Chrome and Java 7 update 5.

harrymc
  • 498,455
nyongrand
  • 746

2 Answers2

95

Put the options in _JAVA_OPTIONS environment variable. How to do this is already described in various other posts – although they usually talk about setting PATH, but it's all the same.

For example, on Linux, put the following in your ~/.profile or ~/.bash_profile:

export _JAVA_OPTIONS="-Djava.net.preferIPv4Stack=true"
grawity
  • 501,077
2

when launching from the command line, add parameter:

-Djava.net.preferIPv4Stack=true

ie:

java -jar -Djava.net.preferIPv4Stack=true some.jar

alex
  • 21