[2.0.4] getting java.lang unknown exception when running any click() from IDE

Asked by leo.xiao on 2020-07-30

os: windows7 x64 + jdk8
sikulixIDE-2.0.4 with jython-standalone jar ready.
additional have python 3.7.5 installed

always getting the error "java.lang unknown excpetion" when running some lines
even looks like unable to execute the API which interact with screenshots on local
e.g.
click([screenshot])
rightClick([screenshot])
...

however, it seemed OK for popup("strings")

have no idea with that, please advise.

BTW, previously tried the same script in IDE with the sikulix-1.1.2 and everything was fine

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
2020-08-05
Last query:
2020-08-05
Last reply:
2020-07-31
RaiMan (raimund-hocke) said : #1

start the ice fromm command line

java -jar <path-to>\sikuliide...jar - v -c

and run a
click(someShot)

The debug output should tell more.

I guess, it is because the OpenCV libs cannot be loaded.

On your system a suitable Vision C++ Redistributable might be missing.
see: https://support.microsoft.com/de-de/help/2977003/the-latest-supported-visual-c-downloads

(I am sorry, but I do not test on Win7 anymore)

leo.xiao (hxleo) said : #2

So I tried a 2 lines script by following your comments:

popup("Test")
click("1596158311940.png")

and received the debug information as below:

[debug] Jython: added as Jython::sys.path[0]:
C:\Users\xiaoli\AddData\Roaming\Sikulix\Lib\site-packages
[debug] Jython: ***** sys.path
 0: Y:\Desktop\test.sikuli
 1: C:\Users\xiaoli\AppData\Roaming\Sikulix\Lib\site-packages
 2: C:\Users\xiaoli\AppData\Roaming\Sikulix\Lib\
 3: C:\Users\xiaoli\AppData\Roaming\Sikulix\Extensions\Lib
 4: C:\Users\xiaoli\AppData\Roaming\Sikulix\Extensions\jython-standalone-2.7.1.jar\Lib
[11561 debug] JythonRunner: ready: version 2.7.1
[debug] Jython: SikulixForJython: init: starting
[debug] Jython: added as Jython::sys.path[0]: C:\Users\xiaoli\AppData\Roaming\Sikulix\Lib\site-packages
[debug] Jython: SikulixForJython: init: success
[debug] Jython: sikuli: Sikuli: starting init
[debug] Jython: use as default region: R[0, 0 1680x1050]@S(0)
[debug] Image: BufferedImage: (1680, 1050)
[debug] Jython: sikuli: Sikuli: ending init
[debug] Jython: use as default region: R[0, 0 1680x1050]@S(0)
[debug] Image: BufferedImage: (1680, 1050)
[debug] Image: reused: 1596158311940.png (file:Y:\Desktop\test.sikuli\1596158311940.png )
[debug] Region: wait: waiting 3.0 secs for 1596158311940.png tp appear in R[0, 0 1680x1050]@S(0)
[debug] RunTime:loadlib: trying opencv_java342
[debug] RunTime:addToWindowsSystemPath: added to systempath: C:\Users\xiaoli\AppData\Roaming\Sikulix\SikulixLibs
[debug] RunTime:checkJavaUsrPath: added to ClassLoader.usrPaths
[debug] RunTime:libsExport: folder exists: C:\Users\xiaoli\AppData\Roaming\Sikulix\SikulixLibs (2.0.4 - 202003140801)
[debug] RunTime:loadLib: opencv_java342.dll (success)
[debug] Finder2: makeMat: INT_RGB (1680x1050)
[debug] Finder2: makeMat: 3BYTE_BGR (45x35)
[debug] Finder2: doFindImage: start (stdDev: 168.9986 mean: 509.013968)
[error] script [ test ] stopped with error in line 2
[error] java.lang.Exception ( java.lang.Exception: unknown exception )
[error] --- Traceback --- error source first
line: module ( function ) statement 2: main ( <module> ) click("1596158311940.png")
[error] --- Traceback --- end ---------------
[debug] RunTime:***** running cleanUp *****

Looks like the OpenCV libs loaded successfully on my PC but still didn't get anything helpful?

leo.xiao (hxleo) said : #3

Also I have already Visual C++ 2008-2015 Redistributable installed. Should I still try the newer version (say 2017 - 2019)?

Best RaiMan (raimund-hocke) said : #4

There is something odd happening inside the find implementation based on OpenCV.

If things go well, the log should be something like that:
[debug] Finder2: doFindImage: start (stdDev: 152,9759 mean: 659,574423)
[debug] Finder2: doFindImage: in original: %100,0000 (?70) 182 msec
[debug] Finder2: doFindImage: end 183 msec
[debug] Region: wait: 1596185476675.png appeared (M[821,71 106x27]@S(0) S:1,00 C:874,84 [461 msec])

So I think it is worth to try the newer Redistributable.

Another problem might be, that you have a Windows version, that lacks the media extension libraries.

leo.xiao (hxleo) said : #5

Yeah... I think you are right. Some libraries might be probably missing with the OS (kind of simplified ) on my PC. Unfortunately there's no internet access when I work in the office which means getting the solution would take too much effort so I decided to give it up and turn to use the version 1.1.2 again. So far, so good.
Thanks RaiMan!

leo.xiao (hxleo) said : #6

Thanks RaiMan, that solved my question.