I want to fetch all groups available on Linux machine using Java. Can someone tell me which Java API I can use?
Asked
Active
Viewed 209 times
1 Answers
0
If you are willing to give up on the portability of your app(Linux only instead of cross platform deployment) you could do a system call, where you combine the calling of a command line function with the groups command
-
is there any direct way for pulling all groups instead of calling command ? – Shashi Sep 22 '16 at 08:57
-
I think not, but I could be mistaken, as I understand it, java compiles to javacode and that runs on a java virtual machine on your linux machine. That JVM interprets the javacode to machine instructions, since your java code can also run on windows,where there might not be groups, a "getgroups" function isn't available inside the javacode,java itself and thus not in the java virtual machine(since it would never be called) . – Cakes Sep 22 '16 at 12:28