Java Project Administrator Rights for Windows 7

I am creating a swing application (file explorer) that should copy / move files / folders. When I try to copy to some folders, such as Program Files, it throws an exception (access is denied). I can decide by running NetBeans as an administrator.

In any case, can I provide administrator rights only for my project, without starting the entire virtual machine as an administrator?

+6
source share
2 answers

You can, for a really terrible method without cross-platform, use VBScript .ShellExecute and Runtime.exec to force the program to run as an administrator.

For brevity, I created a simple program available at https://dl.dropbox.com/u/26746878/Misc/JavaElevated.zip

It can be launched using java Launcher .

From NetBeans, I would suggest that you somehow ask him to launch Launcher as the main class instead of the main Program .

0
source

Is there a command line launch, I'm sure there is and is a guy (ette) who will write this to us in about 10 hot seconds. Windows 7/64

-2
source

Source: https://habr.com/ru/post/919843/


All Articles