The sikuli does not work after updating the latest sikuli-script.jar of sikuli x

Asked by Gary Lee

i updated the latest sikuli-script.jar of sikuli x in eclipse,and the code in eclipse:
changed the import file as follow:

import org.sikuli.script.Screen;
import org.sikuli.script.Win32Util;
import org.sikuli.script.FindFailed;
public class test_Captcha {
 /**
  * 验证captcha
  */
 @Test()
 public void verifyLoginWithWrongCapture() {
          Screen s = new Screen(100);
  try {

   s.click("imgs/1291974442781.png", 0);
   WaitForPageToLoad.pause(10000);
   s.click("imgs/1293501707656.png", 0);
   WaitForPageToLoad.pause(10000);

  } catch (FindFailed e) {
   e.printStackTrace();
  }
}

the console error is:
Setting connection parameters:127.0.0.1:3251
[TestRunner] Starting executor with time out:2147483647 milliseconds.
[TestNG] Running:
  C:\Documents and Settings\\Local Settings\Temp\testng-eclipse\testng-customsuite.xml

Windows utilities loaded.
FAILED: verifyLoginWithWrongCapture
java.lang.NoClassDefFoundError: com/sun/awt/AWTUtilities
 at org.sikuli.script.Win32Util.setWindowOpaque(Win32Util.java:79)
 at org.sikuli.script.ScreenHighlighter.init(ScreenHighlighter.java:174)
 at org.sikuli.script.ScreenHighlighter.<init>(ScreenHighlighter.java:287)
 at org.sikuli.script.Screen.initBounds(Screen.java:96)
 at org.sikuli.script.Screen.<init>(Screen.java:89)
 at store.scripts.xhtml_temp.test_Captcha.verifyLoginWithWrongCapture(test_Captcha.java:73)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:640)
 at org.testng.internal.Invoker.invokeMethod(Invoker.java:627)
 at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:799)
 at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1103)
 at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:137)
 at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:121)
 at org.testng.TestRunner.runWorkers(TestRunner.java:1098)
 at org.testng.TestRunner.privateRun(TestRunner.java:727)
 at org.testng.TestRunner.run(TestRunner.java:581)
 at org.testng.SuiteRunner.runTest(SuiteRunner.java:315)
 at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:310)
 at org.testng.SuiteRunner.privateRun(SuiteRunner.java:272)
 at org.testng.SuiteRunner.run(SuiteRunner.java:221)
 at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:40)
 at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:83)
 at org.testng.internal.thread.ThreadUtil$CountDownLatchedRunnable.run(ThreadUtil.java:151)
 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
 at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassNotFoundException: com.sun.awt.AWTUtilities
 at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
 at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
 ... 29 more

===============================================
    store.scripts.xhtml_temp.test_Captcha
    Tests run: 1, Failures: 1, Skips: 0
===============================================

null--------------------

===============================================
APP_NEW
Total tests run: 1, Failures: 1, Skips: 0
Configuration Failures: 1, Skips: 0
===============================================

s.click("imgs/1291974442781.png", 0) this sikuli command dose not work at all

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

the Sikuli X Win32Util.dll now needs path-to-Java\jre6\bin in system path
(additionally to the entry path-to-SikuliX\libs)

Revision history for this message
Gary Lee (carrot1192001) said :
#2

i have add the C:\Program Files\Sikuli X\libs and C:\Program Files\Java\jdk1.6.0_10\bin into the Path,But the error is still existed.

Revision history for this message
RaiMan (raimund-hocke) said :
#3

not jdk !!!

it has to point to jre !!!

Revision history for this message
Gary Lee (carrot1192001) said :
#4

i had add the C:\Program Files\Java\jre1.6.0_06\bin into Path
but the console error as below:
Setting connection parameters:127.0.0.1:1284
[TestRunner] Starting executor with time out:2147483647 milliseconds.
[TestNG] Running:
  C:\Documents and Settings\Administrator.LENOVO-1331A2EE\Local Settings\Temp\testng-eclipse\testng-customsuite.xml

Windows utilities loaded.
FAILED: verifyLoginWithWrongCapture
java.lang.UnsatisfiedLinkError: C:\Program Files\Java\jdk1.6.0_06\jre\bin\fontmanager.dll: can not find the correct application。
 at java.lang.ClassLoader$NativeLibrary.load(Native Method)
 at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)
 at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1668)
 at java.lang.Runtime.loadLibrary0(Runtime.java:823)
 at java.lang.System.loadLibrary(System.java:1030)
 at sun.font.FontManager$1.run(FontManager.java:201)
 at java.security.AccessController.doPrivileged(Native Method)
 at sun.font.FontManager.<clinit>(FontManager.java:196)
 at sun.java2d.SunGraphicsEnvironment.addDirFonts(SunGraphicsEnvironment.java:938)
 at sun.java2d.SunGraphicsEnvironment.registerFontsInDir(SunGraphicsEnvironment.java:818)
 at sun.java2d.SunGraphicsEnvironment.access$200(SunGraphicsEnvironment.java:60)
 at sun.java2d.SunGraphicsEnvironment$2.run(SunGraphicsEnvironment.java:193)
 at java.security.AccessController.doPrivileged(Native Method)
 at sun.java2d.SunGraphicsEnvironment.<init>(SunGraphicsEnvironment.java:125)
 at sun.awt.Win32GraphicsEnvironment.<init>(Win32GraphicsEnvironment.java:73)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
 at java.lang.Class.newInstance0(Class.java:355)
 at java.lang.Class.newInstance(Class.java:308)
 at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:68)
 at org.sikuli.script.Screen.<clinit>(Screen.java:20)
 at store.scripts.xhtml_temp.test_Captcha.verifyLoginWithWrongCapture(test_Captcha.java:73)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:640)
 at org.testng.internal.Invoker.invokeMethod(Invoker.java:627)
 at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:799)
 at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1103)
 at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:137)
 at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:121)
 at org.testng.TestRunner.runWorkers(TestRunner.java:1098)
 at org.testng.TestRunner.privateRun(TestRunner.java:727)
 at org.testng.TestRunner.run(TestRunner.java:581)
 at org.testng.SuiteRunner.runTest(SuiteRunner.java:315)
 at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:310)
 at org.testng.SuiteRunner.privateRun(SuiteRunner.java:272)
 at org.testng.SuiteRunner.run(SuiteRunner.java:221)
 at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:40)
 at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:83)
 at org.testng.internal.thread.ThreadUtil$CountDownLatchedRunnable.run(ThreadUtil.java:151)
 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
 at java.lang.Thread.run(Thread.java:619)

===============================================
    store.scripts.xhtml_temp.test_Captcha
    Tests run: 1, Failures: 1, Skips: 0
===============================================

null--------------------

===============================================
APP_NEW
Total tests run: 1, Failures: 1, Skips: 0
Configuration Failures: 1, Skips: 0
===============================================

Revision history for this message
RaiMan (raimund-hocke) said :
#5

you have to use the official current JRE from Sun/Oracle.

Revision history for this message
RaiMan (raimund-hocke) said :
#6

This might be helpful too:

from https://answers.launchpad.net/sikuli/+question/140246 (Sajjad's last comment):

Thanks for all the help. When I removed all the other classes from the
classpath I figured out what the problem was. Jython preprocesses all the
jars and caches it. And it uses JAVA_HOME to find the jre's runtime classes.
And in my pc the java_home was set to jre1.6.0 an older version. Thats the
reason it could not find some classes. When I deleted the
C:\jython2.5.1\cachedir\packages folder then I could see that the runtime
was picked up from another folder. Then I set the correct JAVA_HOME and it
works. Thanks.

Revision history for this message
Gary Lee (carrot1192001) said :
#7

Thx so much,i did update the jre to the latest version and it dose work ok.

Can you help with this problem?

Provide an answer of your own, or ask Gary Lee for more information if necessary.

To post a message you must log in.