Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Changing IP address of local windows machine using NETSH in JAVA- HELP

807589Nov 23 2007 — edited Jul 25 2008
Hi ALL,

I have written one java program to change the IP address of local
machine using netsh command tool and runtime.exec method in java.


String[] command1 = { "netsh", "interface", "ip", "set", "address",
"name=", "Local Area Connection" ,"source=static", "addr=",str1,
"mask=", str2};
Process pp = run.exec(command1);

The program is working fine.

Here I need to set interface name namely "Local Area Connection" in command.
Actually I should not hard code this and I should get this from
getting active network interface name. I have written program for
that, but the name I am getting is like "Intel(R) PRO/1000 PL Network
Connection - Net Firewall Miniport Interface". I am not getting name
as "Local Area Connection".

So please help me to resolve this issue.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 22 2008
Added on Nov 23 2007
5 comments
1,207 views