2

I'm going to develop a java web start application, which need to access protected system directory and install a program there.

I know, how to exit sandbox, my application is signed and have access to filesystem. The problem is, that it sill can't access directories like C:/windows/system32.

I found solutions for standalone java applications: Java: run as administrator

How to do this in java web start?

Thanks in advance for answer!

Community
  • 1
  • 1
Marek Bardoński
  • 529
  • 1
  • 5
  • 14
  • I would be really worried if a web-start application could have administration rights and make changes in the windows folder. I'm not sure if it is possible but I hope it is not. – tom Jun 01 '12 at 09:08
  • I'm just going to automatically install a program needed by my application. It should ask about privileges, and then user accept or reject it. I think it should be possible. – Marek Bardoński Jun 01 '12 at 11:30

1 Answers1

2

In your case you can probably try to use the following trick:

  1. Precompile a jar file with the Manifest pointing to the main class, that carries out all of the required filesystem routines

  2. Put this jar somewhere into the resources folder of your Web-Start application and then copy it into the user's Temp folder upon Web-Start execution

  3. Provision required files from the elevation PowerToys in the similar manner

  4. Call " %PATH_TO_USER_TEMP%/elevate" command together with "java -jar %PATH_TO_USER_TEMP%/yourJar.jar" (please refer to the article above or additional documentation on the Elevation PowerToys to find out the details)

  5. If everything works out, user shall be presented with a request to grant the executed java process required Admin privileges.

Alex Fedulov
  • 1,442
  • 17
  • 26