I am writing a simple java application which executes another command with "sudo" (on Ubuntu). My application works properly when i start it with "sudo my_java_application". But if i start it without sudo it does not works. And it does not ask me for password. It gives error when it executes the command. It gives: "you have not the permissions". What should i write to source of my java program to get (ask) the "sudo" rights?

If i get the right how often i need to get again to execute this command. Because my program executes the command every 10-15-20-25 minutes (sometimes more long, it depends something else) automatically.

Thank you!

Any help please? I just need the code which gets the root permissions :(