Closed QNENet closed 7 years ago
Hi,
The project has been tested on Window -- Windows is my default dev environment. What your seeing is expected behaviour. The lib tries running all possible commands regardless of the OS. ifconfig will fail because it's only available on Linux, but the Windows-specific commands (e.g. ipconfig) won't fail.
The failure being reported is expected and doesn't stop anything from working correctly.
// Perform commands to try to grab gateway addresses
List<MapperIoUtils.ProcessRequest> processReqs = new ArrayList<>();
processReqs.add(new MapperIoUtils.ProcessRequest("netstat", "-rn")); //linux mac and windows
processReqs.add(new MapperIoUtils.ProcessRequest("route", "-n")); // linux
processReqs.add(new MapperIoUtils.ProcessRequest("route", "-n", "get", "default")); // mac
processReqs.add(new MapperIoUtils.ProcessRequest("ipconfig")); // windows
processReqs.add(new MapperIoUtils.ProcessRequest("ifconfig")); // linux (and mac?)
runProcesses(processBus, processReqs, 10000L);
OK, thanks Kasra,
The following error occurs when running on win10. 64bit. I do not think the system on windows should be looking for ifconfig. Has the project been tested on Windows?
java.io.IOException: Cannot run program "ifconfig": CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048) at net.qnenet.portmapper.provider.support.gateways.process.ProcessRunnable.processMessage(ProcessRunnable.java:107) at net.qnenet.portmapper.provider.support.gateways.process.ProcessRunnable.run(ProcessRunnable.java:68) at java.lang.Thread.run(Thread.java:745) Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.(ProcessImpl.java:386)
at java.lang.ProcessImpl.start(ProcessImpl.java:137)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 3 more