You cannot simply request administrative privileges, and you cannot run admin-command-line from an application that has not been run with administrator privileges. This will be a serious security issue.
Instead, you can check to see if your application was run with administrator privileges, and if you do not prompt the user to do this (showing a little How-To on how to do this).
Unfortunately, this seam is becoming a more serious problem, since the standardized method does not apply to all platforms. However, this thread gives some ideas: Detecting if a Java application was running as a Windows administrator
Lukas Knuth
source share