← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #249964]: segmentation error when running the sample Java code

 

Question #249964 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/249964

Shengyuan Gu posted a new comment:
Hi all,

I encounter a similar error if I use relative path in sikulix 1.1.0 beta1 (2014-05-30-18) with java client in Eclipse:
[error] ImagePath: not found on image path: ./images/arc_installer.png
[debug] ImagePath: ImagePath has 1 entries
[error] Image: Image not valid, but TextSearch is switched off!
There is no matched screen shot.

Here are my jdk environment on Windows7 32bits host:
java version "1.7.0_60"
Java(TM) SE Runtime Environment (build 1.7.0_60-b19)
Java HotSpot(TM) Client VM (build 24.60-b09, mixed mode, sharing)

 Here are my code snipet:

public class TestSikuli {
	public static void main(String[] args) throws IOException {
		Screen s = new Screen();
		try {
			if (s.exists("./images/arc_installer.png") == null) {
				System.out.println("There is no matched screen shot.");
				return;
			}
			Pattern p = new Pattern("./images/arc_installer_close.png");
			s.click(p.targetOffset(157, -1));
			s.click("./images/arc_installer_close_ok.png");
		} catch (FindFailed e) {
			e.printStackTrace();
		}
	}
}

Then I inspected into the source using JadClipse, I found that the ImagePath.BundlePath == null, I tried to add the static initialize code beloe in my class, then the java code works well.
	static {
		System.out.println("BundlePath: " + ImagePath.getBundlePath());
		ImagePath.setBundlePath(System.getProperty("user.dir"));
		System.out.println("BundlePath: " + ImagePath.getBundlePath());
	}

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