Reputation: 6411
I want to lookup in my system (using java) for all network cards and network interfaces. So, more exactly, I want to get the whole output from ifconfig
command (in Linux) but in Java. I know if I use NetworkInterface.getNetworkInterfaces()
will return only configured network interfaces.
A rough approach I found at this link. It is OK, but I'm interested if there are other possibilities on this.
Upvotes: 1
Views: 2424
Reputation: 53657
You can use Runtime.getRuntime().exec("ipconfig")
for Windows and Runtime.getRuntime().exec("ifconfig")
for linux to get ifconfig result in java
There is no way to get to the gory details here in 100% Java. You can either execute commands or write JNI.
Upvotes: 2