Reputation: 3547
I'm creating a Windows application using JavaFx
and Intellij-idea
, Some of the functions are executing CMD command. One of the command is route delete 0.0.0.0 mask 0.0.0.0
which will block the machine from using internet connection, but since the command was no right of administrator the result is The requested operation requires elevation.
So, I'm thinking maybe it will solve the problem if I can make the application elevated by setting it up in Intellij-idea.
Is this possible?
Upvotes: 1
Views: 169
Reputation: 3187
Try this Runtime.getRuntime().exec("runas /profile /user:Administrator \"cmd.exe /c Powrprof.dll,SetSuspendState\"");
or you could also make a shortcut to an admin command prompt shortcut and call that
Upvotes: 1