sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #36537
Re: [Question #281182]: Null pointer exception using Sikuli in Java
Question #281182 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/281182
Borja Miñano posted a new comment:
Hi RaiMan,
Sure, the log messages before the exception are the following:
[debug] Debug.init: from sikuli.Debug: on: 3
[debug] RunTimeINIT: lsb_release -i -r -s
[debug] RunTimeINIT: loadOptions: check: /home/bminano/workspace/guiTestingSmall
[debug] RunTimeINIT: loadOptions: check: /home/bminano
[debug] RunTimeINIT: loadOptions: check: /home/bminano/.Sikulix/SikulixStore
[debug] RunTimeINIT: global init: entering as: API
[debug] RunTimeINIT: ScreenDevice 0 has (0,0) --- will be primary Screen(0)
[debug] RunTimeINIT: Monitor 0: (0, 0) 1680 x 1050
I also checked the source code and tried to figure out what can be happening. I adapted some of the source code in my test:
Class clsRef = null;
try {
clsRef = Class.forName("org.sikuli.ide.SikuliIDE");
}
catch (Exception ex) {
System.out.println("Doesn't load SikuliIDE");
}
try {
clsRef = Class.forName("org.sikuli.setup.RunSetup");
}
catch (Exception ex) {
System.out.println("Doesn't load RunSetup");
}
CodeSource codeSrc = clsRef.getProtectionDomain().getCodeSource();
String base = null;
if (codeSrc != null && codeSrc.getLocation() != null) {
base = FileManager.slashify(codeSrc.getLocation().getPath(), false);
}
System.out.println(base);
if (base != null) {
File fSxBaseJar = new File(base);
String jn = fSxBaseJar.getName();
File fSxBase = fSxBaseJar.getParentFile();
System.out.println(jn);
System.out.println(fSxBase);
System.out.println(fSxBase.getAbsolutePath());
}
The exception is launched in the last print since fSxBase is null. The problem I see here is that the fSxBaseJar file is [onTheFly-test-bundle]GuiTestingTest[1957655256], so maybe it is not possible to get its parent file.
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.