Java Is Windows isWindowsAdministrator()

Here you can find the source of isWindowsAdministrator()

Description

is Windows Administrator

License

Apache License

Declaration

static boolean isWindowsAdministrator() 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.File;
import java.io.IOException;

public class Main {
    static boolean isWindowsAdministrator() {
        try {//www .ja  va2s.  co  m
            String programFiles = System.getenv("ProgramFiles");
            if (programFiles == null) {
                programFiles = "C:\\Program Files";
            }
            final File temp = new File(programFiles, "foo.txt");
            if (temp.createNewFile()) {
                temp.delete();
                return true;
            } else
                return false;
        } catch (final IOException e) {
            return false;
        }
    }
}

Related

  1. isWindows()
  2. isWindows()
  3. isWindows()
  4. isWindows()
  5. isWindows64JREAvailable()
  6. isWindowsCygwin()
  7. isWindowsFileSep()
  8. isWindowsFileSystem()
  9. isWindowsInstall()