Here you can find the source of isWindowsAdministrator()
static boolean isWindowsAdministrator()
//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; } } }