rritoch / super-user-application Goto Github PK
View Code? Open in Web Editor NEWExecute Jar's with Administrator privileges
Execute Jar's with Administrator privileges
I'm attempting to write an installer using a swing ui. The problem is that the swing ui is non blocking, therefore the public int run(String[] args) {
exits immediately which kills the UI. I'm not sure if there's a good way to handle this other than to have some kind of flag and to block the int run method until the flag is flipped (install done). Thoughts?
getting this error from console Error: Could not find or load main class
Nice solution, would you consider adding a license to the project?
Hi Ralph,
Our Jar is working fine on Window 7 but not working for Window 8.1
I debugged code,
in WinSudo.java, Line 165- boolean result = Shell32X.INSTANCE.ShellExecuteEx(execInfo);
This line is not opening the User account control popup. But in Window 7, this line open the popup and after clicking yes, further processing working fine.
Could you please help? Also let us know if you need more detail about the issue?
Hi Ralph,
I have used same technique i.e extending my main class with SuperUserApplication and now the privileges issue gone out but it is only working in case of running my jar using command line and using command java -jar test.jar
Whenever I double click on the jar, the warning popup opened but nothing progressing. I debug a bit and found that run(String[] args) method is not getting executed.
Do you know how to overcome this issue?
Hi,
I am extending my main class with SuperUserApplication and my jar is now running in administrator privileges. Thanks for this.
But the only annoying thing is "User account control popup"
After running the jar, I am getting "WARNING: Elevating an application with administrator privileges from a network or removable drive may fail." and after that I am getting the "User account control popup" with message "Do you want to allow the following program to make changes to this computer"
Is there any way to bypass or automatically hide this popup for better user experience?
Also instead of running whole jar in administrator privileges, is it possible to run the particular functionality of jar to be run in administrator privileges?
0.0.5
2.13
SU Application which started initially for sudo permissions should close and let only the subprocess run
SU Application process (initial parent process which requested sudo) remain active even when the new child process has started
For MacOS MacSudo.java I can see that the line 66 inside public static int executeAsAdministrator(String command, String[] args)
causes this.
In my opinion this should be configurable to make sure that long applications don't occupy 2 process.
Let me know your thoughts on this.
C:\Users\CUZZY\AppData\Local\NetBeans\Cache\10.0\executor-snippets\run.xml:111: The following error occurred while executing this line:
C:\Users\CUZZY\AppData\Local\NetBeans\Cache\10.0\executor-snippets\run.xml:68: Java returned: 1
BUILD FAILED (total time: 6 seconds)
Hallo,
after I call SU.run(new Main(), args) the UAC window in Windows 10 shows up and I can press OK, but after I pressed OK the Application exits and run(String[] args) is not called.
I also get this warning:
WARNING: Elevating an application with administrator privileges from a network or removable drive may fail.
I am not working on a network or removable drive. I am elevating the application on the C drive.
What could be wrong?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.