2

As always, I did research a bit on my own beforehand, I now seek for general approaches in order to solve this. My situation:

Application needs to get updated (write to program files). If the program runs with admin rights, the update succeeds. If I don't, it fails because of permission errors.

Now what I could do is prompt the user to elevate my rights for the update. There should be a way to do it without though, like for example the Mozilla Maintenance Service which can allows even normal users to update.

So my questions would be:

  • How can I elevate my program to admin without prompting (if the user is admin)
  • How would I manage to implement an update that does not require any administrative credentials at all?
David Trevor
  • 794
  • 1
  • 7
  • 22
  • 2
    here you go: http://stackoverflow.com/questions/21052384/write-to-c-program-files-from-java-program –  May 19 '16 at 10:47
  • Check out my answer here, maybe it helps (for building a background update service which doesn't ask for admin rights): http://stackoverflow.com/a/36838171/1871033 – CherryDT May 19 '16 at 11:12
  • Don’t do application updates yourself. Use [Java Web Start](http://docs.oracle.com/javase/8/docs/technotes/guides/javaws/) for installing your application. It handles updates and much more. – VGR May 19 '16 at 11:34
  • The Mozilla Maintenance Service is a service, configured to run as local system, i.e., with administrator privilege. There's nothing in principle stopping you from writing a service to install your updates for you, but it's not trivial. – Harry Johnston May 20 '16 at 01:05
  • Think of your question this way: "Hi, I'm writing a malware application, and I want to write to program files without permission. How can I do this?" – Bill_Stewart Jun 07 '16 at 15:21

0 Answers0