2

I need to be able to enable/disable the IPv6 settings on my computer from within a Java program.

Basically, I need to follow these directions to turn IPv6 on and off: How To Disable IPv6 On Windows 7

But I need to be able to do that though a Java program. Is this possible?

I'm running on Windows 7.

Kevin Panko
  • 8,356
  • 19
  • 50
  • 61
caris
  • 31
  • 1
  • 5

2 Answers2

0

Please see the tool netsh, specifically to install IPv6 support:

netsh int ipv6 install

To remove:

netsh int ipv6 uninstall

Also documented under KB2478747.

See the question How to Execute Windows Commands Using Java - Change Network Settings to integrate within a Java application.

Runtime.getRuntime().exec("netsh int ipv6 install");
Community
  • 1
  • 1
Steve-o
  • 12,678
  • 2
  • 41
  • 60
  • I tried this solution and it required a reboot to take effect. I can't reboot. When I manually turn IPv6 on/off by checking/unchecking the IPv6 box in the control panel, I don't have to reboot for the changes to take effect. I'm doing automated testing, "turn it on, make sure something works, turn it off, make sure it still works". So I don't want reboots in the middle of my test plan. I need a command line way to do the same thing as checking/unchecking the box in the control panel. Thanks! – caris Mar 26 '15 at 14:18
0

I was able to do this using a utility I downloaded and installed called nvspbind. With this installed, the calls to turn IPv6 and off are:

nvspbind.exe /e "Local Area Connection" ms_tcpip6 nvspbind.exe /d "Local Area Connection" ms_tcpip6

caris
  • 31
  • 1
  • 5