0

I have code which requires administrator privileges on MacOS. How can a java application be launched from eclipse with elevated permissions without exporting it to a jar beforehand?

As pointed out in the comment of this answer https://stackoverflow.com/a/2580560/3244464 running eclipse as root itself is undesirable due to potential permission issues.

Kilian
  • 1,540
  • 16
  • 28
  • Did you read the rest of the linked question ? [this answer](https://stackoverflow.com/a/9979027/4391450) seems promising. I don't see the different between your question and the one you linked... – AxelH Apr 17 '18 at 10:10
  • @AlexH this approach seems really bothersome for a simple task as running a task as administrator. It's code I intend to share and I can't ask everyone to perform these steps. – Kilian Apr 17 '18 at 10:29
  • 1
    If you want to "share" you code, export it as a jar.... to be executed. I doub you can add a line in your code to grant yourself the root privileges (damn this would be unsafe). Eclipse isn't suppose to be a production environment, it's purpose is for development and testing. Use a mock system to "hide" the restricted system if needed. But you will not get a simpler solution than the linked you provide yourself. – AxelH Apr 17 '18 at 10:45

0 Answers0