test/java/net/NetworkInterface/IPv4Only.java
Print this page
@@ -21,23 +21,21 @@
* questions.
*/
/* @test
* @bug 6964714
- * @run main/othervm IPv4Only
+ * @run main/othervm -Djava.net.preferIPv4Stack=true IPv4Only
* @summary Test the networkinterface listing with java.net.preferIPv4Stack=true.
*/
import java.net.*;
import java.util.*;
public class IPv4Only {
public static void main(String[] args) throws Exception {
- System.setProperty("java.net.preferIPv4Stack","true");
-
Enumeration<NetworkInterface> nifs = NetworkInterface.getNetworkInterfaces();
while (nifs.hasMoreElements()) {
NetworkInterface nif = nifs.nextElement();
Enumeration<InetAddress> addrs = nif.getInetAddresses();
while (addrs.hasMoreElements()) {