I am trying to make a program in Java that gathers some information about the computer it's being executed on. I get the information by using things like:
Process rt = Runtime.getRuntime ().exec("ipconfig");
In the exec("ipconfig") command, it returns a lot more information that I'm specifically asking for. For instance, I need the IP Address. In the command, it's labeled as "IPv4" (or something similar). I have used BufferedReader, to get the InputStream of the Process, and I converted the InputStream into String, and got the indexOf ("IPv4"). Unfortunately, that's as far as I can get. I need to convert it back into a String, that only contains the line that's labeled "IPv4".
I have found other questions on here, that are really similar to this, but I can't seem to understand them. Could someone please explain how to do this specifically, in detail?
Update: I need to do this from the Runtime method. I know that I could use the InetAddress methods, but this is just one example of it. I will be getting other information from the runtime, and I need to know how