Ho risolto il problema in modo poco ortodosso, am funzionante... utilizzando rsh... Posto il codice, se può servire a qualcun'altro...
import java.io.File;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Esegui
{
public static void start(String cmd) throws IOException
{
String s = null;
// system command to run
//String cmd = "rsh xxx.xxx.xxx.xxx -l user command";
try {
Process p = Runtime.getRuntime().exec(cmd);
int i = p.waitFor();
if (i == 0)
{
BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
// read the output from the command
while ((s = stdInput.readLine()) != null)
{
System.out.println(s);
}
}
else
{
BufferedReader stdErr = new BufferedReader(new InputStreamReader(p.getErrorStream()));
// read the output from the command
while ((s = stdErr.readLine()) != null)
{
System.out.println(s);
}
}
}
catch (Exception e)
{
System.out.println(e);
}
}
public static void main (String[] args) throws Exception {
Esegui esegui = new Esegui();
Esegui.start("dir");
}
}
![]()

Rispondi quotando




