I was trying to run this code on Linux as a normal user but due to insufficient privileges listfiles() returning null.
File parentDirectory = new File("/root");
File[] childFiles = parentDirectory.listFiles();
How can I run the above code without running java application in SU mode.
- Can I ask the user to enter root password? So that I can run linux commands instead of java functions.
What all options I have to achieve this in java?