← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #254556]: Importing Java Lib on Sikuli

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
java "libs" (usually available as jar files) have to be on the Java class path on runtime.
There are many ways, to make it available.

the easiest in Jython: you might add the path to the jar file to
sys.path at runtime before you use it:

myJar = "absolute path to jar lib"
if not myJar in sys.path: sys.path.add(myJar) 

now you can import classes from this jar and use them:
import org.somegroup.somepackage.SomeClass as XX

where XX is a short name (optional convenience) to be used instead of
SomeClass.

Now you can use XX according the docs of the jar lib, usually:
oXX = XX(some, parameter, ...) # creates a new XX object
oXX.doSomething(parameter, ...) # calls a function of XX

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