It turns out that if your Java app is getting IPv6 addresses back from InetAddress.getLocalHost().getHostAddress() you can use flags to the Java VM to control this behaviour
-Djava.net.preferIPv4Stack=true
if you only want IPv4 addresses returned, or
-Djava.net.preferIPv6Stack=true
if you need to test your code against IPv6 addresses. These flags are only valid when passed to the JVM when it’s started up (ie they can’t be changed once the App’s running).