← Back to team overview

sikuli-driver team mailing list archive

[Question #235217]: [1.0.1] App.open() doesn't work in java code on linux

 

New question #235217 on Sikuli:
https://answers.launchpad.net/sikuli/+question/235217

Hi, 
i'm using sikuli libraries in Eclipse (on a linux machine) to create a GUI test program. 

I've issue with the App.open() function and, more general, with every function which uses Runtime.getRuntime().exec(cmd); under linux. They all produce the following exception:

CMD Error:java.io.IOException: Cannot run program CMD: java.io.IOException: error=2, No such file or directory

on windows, the same code worked fine.

from my tests seem that getRuntime().exec() need the absolute path to the program, so taking App.open() implementation in linux utils as example:

String cmd[] = { "sh", "-c", "(" + appName + ") &\necho -n $!" };
Process p = Runtime.getRuntime().exec(cmd);

return sh Error:java.io.IOException: Cannot run program sh: java.io.IOException: error=2, No such file or directory

instead using "/bin/sh"

String cmd[] = { "/bin/sh", "-c", "(" + appName + ") &\necho -n $!" };
Process p = Runtime.getRuntime().exec(cmd);

opens the programs as expected.

I cannot redefine every method which uses getRuntime().exec() (lots of them are in LinuxUtils class),is there a workaround to use those methods under linux?

this is my configuration:
Eclipse 3.6.2
Xubuntu 12.04
Sikuli 1.0.1




-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.