I try to launch a command in Linux with Java with sudo
and I can not find the way. I tried the following, but ... even though from the terminal it works, since the execution of my program it does not.
public Boolean activarServicio(){
lanzarComando();
Boolean finaly = false;
try{
if(!estado){
consola2=Terminal.lanzarComando("teamviewer --daemon enable");
//consola2=Terminal.lanzarComando("echo mipassword | sudo -S teamviewer --daemon enable");
finaly = true;
}
}catch(IOException err){
}
return finaly;
}
Does anyone have any idea how to solve this?