PDA

View Full Version : [JAVA] exec()


Daikin80
05-07-2010, 00:17
Ho un problema con il seguente comando :
Runtime.getRuntime().exec("gedit"); in questo caso funziona benissimo , mi apre un nuovo documento con gedit

adesso vorrei lanciare il terminale :
Runtime.getRuntime().exec("/bin/bash"); perņ nn succede nulla...
ho provato anche a lanciare uno script Runtime.getRuntime().exec("/bin/bash /home/usr/script.sh");

Process theProcess=null;
//Runtime.getRuntime().exec("gedit");

try
{
theProcess = Runtime.getRuntime().exec("/bin/bash");
// theProcess = Runtime.getRuntime().exec("/bin/bash /home/usr/script.sh");
}

catch(IOException e)
{
System.err.println("Error on exec() method");
e.printStackTrace();
}

Grazie