I need to find the logged in user from the java code, so i use following options: Runtime.getRuntime.exec("who") Runtime.getRuntime.exec("who am i")
Both give same result (the result that i get when i give who command on the prompt). I guess it is not recognising anything after space. I tried it with other commands too but same result.
Is there a problem with code or i need to set some environment, plz help.