Skip to content

Instantly share code, notes, and snippets.

Last active October 2, 2021 21:22
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
An example case for the failure to retrieve uid, gid and groups if the user has no username
public class UnixSystemNameless {
public static void main(String[] args) {
final var unixSystem = new;
System.out.printf("username: %s%n", unixSystem.getUsername());
System.out.printf("uid: %d%n", unixSystem.getUid());
System.out.printf("gid: %d%n", unixSystem.getGid());
System.out.printf("groups: %s%n", java.util.Arrays.toString(unixSystem.getGroups()));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment