Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do I need java.net.preferIPv4Stack=true only on some windows 7 systems?

I have used Java on Windows 7 (64bit) machines for quite some time and have never had problems with not being able to create a network connection. Now on the systems at the company I'm working for I need to set "-Djava.net.preferIPv4Stack=true" or it seems the java processes are not able to create a single connection.

The downside is that if I don't set "_JAVA_OPTIONS" I would have to configure tons of services to use this setting. However if I use it Java outputs this silly "Picked up: _JAVA_OPTIONS..." to stderr (Wonder which guy made that silly decision). This however makes my GWT compiles fail in IntelliJ.

What I would like to know ... this is the first time I'm having these problems and I guess they must somehow be related to the setup of the Operating System. What is probably causing these problems (As I mentioned ... I have about 4 other Systems with windows 7 and 64 bit java vms that don't have these problems).

Chris

like image 280
Christofer Dutz Avatar asked Jul 15 '13 06:07

Christofer Dutz


2 Answers

Ok so we found out the reason.

This problem seemed to have occured on systems containing a special version of remote access software that our company used. This seems to have inserted some modified dlls into Windows network stack (We were told in order to auto-detect network connectivity). It seems this dll had some issues, causing all IPv6 traffic to be blocked. It also caused the affected Machines to have regular Bluescreens. Uninstalling that software got the system Bluescreen free and I no longer need the preferIPv4Stack setting.

like image 58
Christofer Dutz Avatar answered Oct 08 '22 23:10

Christofer Dutz


This is just a theory ...

According to the Java documentation, if IPv6 is available on the operating system, the underlying native socket will be an IPv6 socket.

If the operating system doesn't have IPv6, or it has properly configured IPv6, that's what you want. But if the operating system has IPv6 that is not working properly, then I imagine that Java will attempt to use IPv6 to make connections and fail.


However if I use it Java outputs this silly "Picked up: _JAVA_OPTIONS..." to stderr.

According to this Q&A, there is no way to turn it off: Suppressing the "Picked up _JAVA_OPTIONS" message

I would suggest setting _JAVA_OPTIONS globally (if you must) and then unsetting it for the environment you launch your IDE from.

like image 36
Stephen C Avatar answered Oct 08 '22 23:10

Stephen C