I've written a class to run a command checking if the OS is Windows or Mac.
When it's been run on a Windows Machine, it works perfectly! When I run it on my Mac, it just returns a simple text saying, "Disabled."
Is this because Mac has some restrictions to access some data through exec?
Just to let you know I'm setting args, so then I use the following to run it:
If you need the full source, it's HERE.
Thanks!
Code:
if (currentOS.contains("WINDOWS")) {
args = new String[] { "cmd.exe", "/c", "dir", "|", "find", "/i", "Serial Number is" };
} else if (currentOS.contains("MAC")) {
args = new String[] { "system_profiler", "SPHardwareDataType", "|", "grep", "Hardware UUID" };
} else {
args = new String[] { "" };
}
When it's been run on a Windows Machine, it works perfectly! When I run it on my Mac, it just returns a simple text saying, "Disabled."
Is this because Mac has some restrictions to access some data through exec?
Just to let you know I'm setting args, so then I use the following to run it:
Code:
Runtime.getRuntime().exec(args);
If you need the full source, it's HERE.
Thanks!