Posts Tagged ‘java error

22
Jul
08

jdk 1.6.0 error on freebsd

I got the following error everytime I run my Java code using JDK 1.6.0 on FreeBSD 7.0 Stable.

java.io.IOException: Invalid argument
at java.net.PlainDatagramSocketImpl.send(Native Method)
at java.net.DatagramSocket.send(DatagramSocket.java:612)

I’ve been wondering what’s wrong since then. Thanks to this site, now I found the solution. Somehow, seems like Java always interpret the send method to use IPv6 related parameter, which of course will fail in case we use IPv4 parameter. We have to add parameter -Djava.net.preferIPv4Stack=true so that our code run smoothly.

Ijyou desu..