sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #27088
Re: [Question #251689]: Java Sikuli program works within Netbeans but fails once built as a Jar
Question #251689 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/251689
Nathan Ash-Vie posted a new comment:
This is what I get using -Dsikuli.Debug=3 (looks like version Sikulix
1.01):
[debug] Screen: initScreens: basic initialization (2 Screen(s) found)
[debug] *** monitor configuration (primary: 0) ***
[debug] Screen 0: S(0)[0,0 1280x1024]
[debug] Screen 1: S(1)[1280,0 1280x1024]
[debug] *** end monitor configuration ***81787
[debug] waiting for P(//whds001/users/Ashvien/NetBeansProjects/I90AutomationTool/build/classes/system/model/i90/imgs/UN002.PNG) S: 0.7 to appear
[debug] Screen.capture: java.awt.Rectangle[x=0,y=0,width=1280,height=1024]
[debug] RobotDesktop: captureScreen: on 0 using java.awt.Rectangle[x=0,y=0,width=1280,height=1024]
[debug] ResourceLoaderBasic: SikuliX Package Build: 1.0.1 12SEP2013160242
[debug] ResourceLoaderBasic: check: we are running on arch: amd64
[debug] ResourceLoaderBasic: check: using Java at: C:/Program Files/Java/jdk1.7.0_45/jre/
[debug] ResourceLoaderBasic: check: Exists libs folder at location of jar? YES: G:/UW/EDI/Automated Testing Tool/Packages/
[debug] ResourceLoaderBasic: checkLibsDir: G:/UW/EDI/Automated Testing Tool/Packages/libs
[debug] ResourceLoaderBasic: loadLib: WinUtil
[debug] ResourceLoaderBasic: loadLib: Found: WinUtil
[debug] ResourceLoaderBasic: loadLib: Now loaded: WinUtil
[debug] ResourceLoaderBasic: checkLibsDir: Using libs at: G:\UW\EDI\Automated Testing Tool\Packages\libs
[debug] ResourceLoaderBasic: check: Using this as OCR directory (tessdata) too
[debug] ResourceLoaderBasic: loadLib: VisionProxy
[debug] ResourceLoaderBasic: loadLib: Found: VisionProxy
[debug] ResourceLoaderBasic: loadLib: Now loaded: VisionProxy
[debug] P(//whds001/users/Ashvien/NetBeansProjects/I90AutomationTool/build/classes/system/model/i90/imgs/UN002.PNG) S: 0.7 has appeared.
[log] CLICK on L(211,258)@S(0)[0,0 1280x1024]
[log] TYPE "#F3."
[debug] Robot: doType: F3 ( 114 )
[log] TYPE "#ENTER."
[debug] Robot: doType: Enter ( 10 )
[log] TYPE "DRCAR"
[debug] Robot: doType: Shift ( 16 )
[debug] Robot: doType: Shift ( 16 )
[debug] Robot: doType: Shift ( 16 )
[debug] Robot: doType: Shift ( 16 )
[debug] Robot: doType: Shift ( 16 )
[log] TYPE "#TAB."
[debug] Robot: doType: Tab ( 9 )
[log] TYPE "#TAB."
[debug] Robot: doType: Tab ( 9 )
[log] TYPE "#TAB."
[debug] Robot: doType: Tab ( 9 )
[debug] ResourceLoaderBasic: loadLib: Is already loaded: WinUtil
[log] TYPE "#TAB."
[debug] Robot: doType: Tab ( 9 )
[log] TYPE "#TAB."
[debug] Robot: doType: Tab ( 9 )
[log] TYPE "#TAB."
[debug] Robot: doType: Tab ( 9 )
[log] TYPE "#TAB."
[debug] Robot: doType: Tab ( 9 )
[log] TYPE "#TAB."
[debug] Robot: doType: Tab ( 9 )
[log] TYPE "UK"
[debug] Robot: doType: Shift ( 16 )
[debug] Robot: doType: Shift ( 16 )
[log] TYPE "#ENTER."
[debug] Robot: doType: Enter ( 10 )
[log] TYPE "#ENTER."
[debug] Robot: doType: Enter ( 10 )
[log] TYPE "#ENTER."
The above works fine in debug, when run as a Jar the first image check
fails:
//whds001/users/Ashvien/NetBeansProjects/I90AutomationTool/build/classes/system/model/i90/imgs/UN002.PNG
The path to the above when run from the compiled Jar as reported by the
getPath() function of getResource() is:
file:/F:/NetBeansProjects/I90AutomationTool/dist/I90AutomationTool.jar!/system/model/i90/imgs/UN002.PNG
The above is blank where a resource cannot be found so the fact that
getPath() returns the images location suggests it is there in Jar - I
can confirm this by opening the Jar in 7-zip and browsing to the file.
So it seems to be my getPattern() function stops working when the app is
built (or there is some kind of Siluli problem locating the file within
the Jar?):
public Pattern getPattern(String name) {
String path = getClass().getResource("/system/model/i90/imgs/" + name).getPath();
return new Pattern(path);
}
Struggling for ideas as to what it could be.
Thanks for taking the time to reply thus far :)
Nathan
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.