-1

I'm writing a Java application, I need to create a URI Scheme. I've seen a library creating a URI Scheme using the "regedit" command on Windows.

Is it safe to execute "regedit" for this task? Is there anything I should avoid or do in a application that is using the command?

4
  • 1
    What do you mean by "safe?" Will it set off a nuclear missile? Probably not. Does it have the potential for damaging the software on your computer, requiring you to reformat the machine and reinstall the software? Maybe. Nov 22, 2015 at 23:40
  • It's a really noob question, I never had to use regedit for anything, so I don't know how "dangerous" it can be Nov 22, 2015 at 23:43
  • No more dangerous than manipulating the registry with code that you don't understand, I suppose. Nov 22, 2015 at 23:44
  • Maybe. I have to read more about the registry. Nov 22, 2015 at 23:51

1 Answer 1

2

Launching RegEdit may require administrative privileges, (depending on who is attempting to run it,) so if you attempt to do that, either your application will need to always run with elevated privileges, or some of your users will be prompted with a UAC dialog each time you attempt to launch RegEdit on their behalf. That's not very nice. Why don't you just directly manipulate the registry ? See: https://stackoverflow.com/a/6163701/773113

5
  • 1
    I searched for questions about URI Schemes in Java and I only found that library. That answer definitely solves my problem, thank you. Nov 22, 2015 at 23:41
  • @RobertHarvey It's a lot of reflection, reflection always looks dangerous, I can definitely make that code faster and simpler Nov 22, 2015 at 23:44
  • Running regedit does not require admin rights - however it is possible that the administrator has disabled it from normal users on your machine. In the normal case, a normal user can launch regedit just fine but can obviously only change his own keys/values with it.
    – Brandin
    Nov 24, 2015 at 8:33
  • @Brandin thank you for the input. This is really weird. Every time I run regedit, I get the UAC. (That's why I thought that it always requires elevation.) But if I switch to my wife's unprivileged account, and try to run regedit, I do not get the UAC.
    – Mike Nakis
    Nov 24, 2015 at 12:42
  • @Brandin I amended my answer, but if you think that the wording can be improved, or that the meaning is still off, please advise.
    – Mike Nakis
    Nov 24, 2015 at 12:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.