Is it possible to run an application in Java with administrator rights? Programmatically
|
1 answer
Yes, there is such an opportunity. To do this, you must perform 2 steps:
- To figure out how to run the application from the console on the target platform on behalf of the Administrator;
- Using
ProcessBuilderexecute this command from your application (see here: Running the application using java ).
- Console commands are not serious. Call the operating system function to run a program using JNI or JNA. - Sergey
- one@Sergey This, in my opinion, would be too crutch. Although, you can try to give your answer with a detailed description of the actions and perhaps he will like the topstarter more. - zed
- @Sergey, in Java do not. There is a special class ProcessBuilder, and they need to use. Starting a "console" application from this point of view is no different from running a "non-console". - Nofate ♦
- @Nofate Still, there is a slight difference in whether you start the application immediately, or first an application that launches another application that launches the third, etc. until it starts up, for the sake of which this chain of launches was conceived. Not? - Sergey
|