0
votes

I am developing a Java application that calls a python script behind the scene.

This is the way i call my python script:

Runtime r = Runtime.getRuntime();
Process p = r.exe("/path/to/Python/script.py");

I can see that my python script running in the background using ps.

The script requires root privileges so sudo prompts for password.

I have seen 2 solutions for this:

  1. Import Python Module pExpect and fill sudo as it shows up.
  2. Add jython java module to my library.

Both of them are overhead to my application, i don't need to interact with the script, i just want it to run in the background.

Is there a way to pop SUDO in UI, so user will interact and continue?

Thanks.

1

1 Answers

0
votes

Use gksudo in place of sudo. It automatically pops up a window asking for the password.