super-user-application icon indicating copy to clipboard operation
super-user-application copied to clipboard

run(String[] args) is not called

Open Joge97 opened this issue 8 years ago • 6 comments

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?

Joge97 avatar Mar 23 '16 18:03 Joge97

Hi,

Can you check your environment variables to see if there are any settings that could be interfering with relaunching the app as SUID, such as JAVA_TOOL_OPTIONS? I have suspected this is a problem across platforms but I only ran into it on linux so the linux deployment is the only one that handles it. Other than that the only other cause of failure that I'm aware of is the one you mentioned when the administrator doesn't have access to the application from the same path such as with removable or network drives.

rritoch avatar Mar 24 '16 03:03 rritoch

Hello,

I have only set JAVA_HOME, JDK_HOME and ANT_HOME, that have to do something with java. I am running Eclipse of my Data Drive E:/ (wich is an internal HDD) and the workspace is on my OS Drive C:/ (which is an internal SSD). I have also tried to run Eclipse from C:/, so both are on the same internal drive, but that also has not worked. I have also tried to export it, but it changes nothing. So is it a Windows 10 issue?

Joge97 avatar Mar 24 '16 06:03 Joge97

This library has been tested on Windows Vista, Windows 7, Windows 8, Windows 10, and Windows 10 Pro and works on most machines. I don't know what bug you are running into but there was a similar issue reported for a specific Windows 7 machine. I have not yet been able to determine why this library works fine on one machine but not on another when they are both running the same OS which is why I suspected the JAVA_TOOL_OPTIONS. I will leave this issue open but as of now I don't have any solution since I have no way to reproduce the issue. If you can find and repair the bug please submit a pull request. I developed this library on a windows 10 pro machine and I haven't been able to reproduce the issue.

rritoch avatar Mar 24 '16 16:03 rritoch

Hi all.

I think I figured it out why it's not working properly. After thoroughly debugging your project, I saw that the command line arguments are wrong. In my case: path_to_java_executable -Dfile.encoding custom_main_class. This command is missing the executable .jar file location! What you want is: path_to_java_exec (-Dfile.encoding) -cp "path_to_jar_file" custom_main_class. I hope this will help everyone. Keep in mind that you need to change the source code accordingly, i.e WinSudo class sudo method. Have a nice day!

jaszfalvitamas avatar Mar 15 '17 14:03 jaszfalvitamas

Jaszfalvitamas if you have the solution (the class fixed) please ask me to share it, it is important because I am doing a Java project in NetBeans and I need to run it with administrative privileges using the library super-user-application. My email is [email protected]

ghost avatar Jun 14 '17 02:06 ghost

it's not working.. can't see the System.out.println("RUN AS ADMIN! YAY!"); I'm on windows 10.

francogp avatar Aug 18 '17 01:08 francogp