← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #220554]: how to configurate classpath when using my jars in Sikuli

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
This works:

- Java project:
use a package name, that does not start with any of the often used top-names like org, com, ... (blocked by Jython)
example in your case:
wilson.info

- the jar
-- no load() required
make a jar named wilson.jar
and place it in the your-script.sikuli folder
(other places are possible, but then you have to append this place to sys.path before issuing the import or use a load() with a path)
-- load() required
name the jar as you like and use
load("path-to-your.jar")
before the import

- in the IDE

--- no load: jar named as top level, jar in .sikuli folder  
import wilson.info.SomeClass as SomeClass
# the jar will be found and loaded automatically
SomeClass.method()

--- simple load: jar named as top level, jar in same folder as script folder
load("..\\wilson.jar")
import wilson.info.SomeClass as SomeClass
# the jar will be found and loaded automatically
SomeClass.method()

in all other cases you need an adequate load() that specifies the path
to the jar (relative or absolute).

--- This was my Java test source:

package raiman.stuff;
public class Case {
	public static void main(String[] args) {
		System.out.println("Hello");
	}
}

The jar for the different tests was named raiman.jar (no load() required
is in .sikuli) or xraiman.jar (load() required in all cases)

--- This was my test.sikuli

# load("xraiman.jar") # inside .sikuli
# load("..\\xraiman.jar") # same folder as  .sikuli
# load("c:\\folder\\subfolder\\xraiman.jar") # somewhere else

import raiman.stuff.Case as Case
Case.main(("",))
for e in sys.path: print e

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