How to import org.sikuli.script with sikulixapi.jar

Asked by Jimin Fan on 2017-01-06

Hello!

I am attempting to use SikuliX with my jython environment, but I also want to use jython-standalone.

I managed to install Sikulix 1.1 on my machine, and I now want to run SikuliX with my jython-standalone-2.7.0.jar.

I have added sikulixapi.jar to PATH and CLASSPATH environmental variables, as well as having

sys.path.append("C:/Tests/Sikuli/sikulixapi.jar")

import org.sikuli.script.SikulixForJython
from sikuli import *

in the beginning of my script;

To run the script, I am running

java -jar jython-standalone-2.7.0.jar myScript.py

I am getting the error:

RunTimeINIT: ***Terminating: no valid Java context for SikuliX available (java.security.CodeSource.getLocation() is null)

I know I must be doing something wrong; but first I want to ask is it even possible to use SikuliX with standalone jython, and if it is possible, what can I do to try and resolve this problem? I have looked at similar threads, and I know it is probably an environmental variable problem...

Thanks!

Question information

Language:
English Edit question
Status:
Expired
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2017-01-09
Last reply:
2017-01-25
Jimin Fan (jimin) said : #1

Follow up about my Issue after reading a few more similar threads:

1. My OS is Windows Server 2008 R2 Standard, Java version is 8 Update 111

2. I manually set %CLASSPATH% to the jdk\lib and sikulixapi.jar

3 .sikulixapi.jar is also in my PATH variable

4. I have sys.path.append("C:/Automation/Sikuli/includes/sikulixapi.jar") in beginning of my script (I have used sys.path.append("C:/Automation/Sikuli/includes/sikulix.jar") too, but got the same error)

5. When I run some sample scripts with the IDE, they work.

Not quite sure where I can begin to isolate the problem;

Thanks!

Jimin Fan (jimin) said : #3

Hey RaiMan, thanks for answering!

I followed the link you posted above, including

https://answers.launchpad.net/sikuli/+question/268529

(don't know if the answer you gave in that question is still relevant now), but I am still encountering the same problem where it says it terminates because there is no valid Java context for SikuliX available

I installed SikuliX along with the associated JAR files through the offline method; something could have gone wrong there, but it did say it successfully installed (proven through the scripts successfully running in IDE)

From your answer in https://answers.launchpad.net/sikuli/+question/268529, you mentioned something about sikulixapi.jar/Libs; I've tried adding that to CLASSPATH, but I still get the same error.

Thanks!

Launchpad Janitor (janitor) said : #4

This question was expired because it remained in the 'Open' state without activity for the last 15 days.