[error] Can't create OS Util: org.sikuli.script.Win32Util- exception is thrown whil eusing Sikuli through java

Bug #893909 reported by santosh
20
This bug affects 3 people
Affects Status Importance Assigned to Milestone
SikuliX
Fix Released
Critical
RaiMan

Bug Description

I am running Sikuli through java, by using Sikuli-script.jar, while running the script i get the below exception
"[error] Can't create OS Util: org.sikuli.script.Win32Util"
Environment: Windowd 7 (32 bit)
Installed JDK 1.6.0.29,jre6
JDK path, JRE path and Sikuli path are given in the system path variable.

Issue is observed on Windows7 only and its consistent

Tags: idestartup
Revision history for this message
RaiMan (raimund-hocke) wrote :

What version of Sikuli?

Pls. paste some specific code, to reproduce the problem.

Revision history for this message
santosh (santosh-ssit) wrote :

Issue is observed on Sikuli-X-1.0rc3 (r905)-win32 On Windows7 OS.
 issue is observed in 2 out of 3 windows 7 machines. same code works on other windows 7 and also on Mac Os X.
below is the sample code.
Sikuli-X-1.0rc3 (r905)-win32
public class TestNGTest {
    static Selenium selenium;
    WebDriver driver = null;
    Screen sikuli=new Screen();
    @BeforeTest
    public void startSelenium() throws Exception {
        driver = new FirefoxDriver(profile);
        selenium = new WebDriverBackedSelenium(driver, "http://www.google.co.in");
    }
    @AfterTest
    public void stopSelenium() {
        try {
            captureScreenShot();
        } catch (Exception e) {
        }
    }

    @Test
    public void clickOnAllowButtonOnFirefox() throws Exception {

        sikuli.wait("C:\\Automation\\Installer\\xpiicon.png");
        sikuli.wait("C:\\Automation\\Installer\\allowbtnOnBrowser.png");

    }

exception is thrown while initialing sikuli @ "Screen sikuli=new Screen();" line

Revision history for this message
santosh (santosh-ssit) wrote :

Complete exception is captured in the attached file.

Revision history for this message
RaiMan (raimund-hocke) wrote :

Seems to be principally ok.

You say: issue is observed in 2 out of 3 windows 7 machines. same code works on other windows 7

So the question is: What are the differences between the systems and their setup?

I cannot reproduce this behavior on my Win7-32

Revision history for this message
santosh (santosh-ssit) wrote :

There is no difference in the setup all the 3 windows 7 are having same version of OS, same version of Sikuli, same version of JAVA installed. as per my understanding i think, there is an access problem for JVM while loading native win32dll.
Could you please go through the Exceptions i have attached and suggest me if i need to make any changes to make it working.
There are no difference wrt PATH on 3 Windows machines.

Revision history for this message
RaiMan (raimund-hocke) wrote :

Again having looked at the code:

The error happens, when the trial to copy Win32Util.dll from inside sikuli-script.jar to the folder tmplib in the users standard personal temp folder (Win7: \Users\<username>\AppData\Local\Temp) where the folder is created, if it does not exist. This is for cases, where sikuli-script.jar is intended to be used somehow standalone.
If there are some access right problems (which sometimes occur), then this action should crash.

This action does not take place at all, if the environment variable SIKULI_HOME is correctly set (which is normally done by a Sikuli installation from the download .exe).

So this might be the difference between the systems.

This should be the correct setting:
SIKULI_HOME=path-to-sikuli-program-folder\

The trailing backslash is mandatory!

e.g. in the standard installation:
SIKULI_HOME=c:\Program Folder\Sikuli X\

Revision history for this message
santosh (santosh-ssit) wrote :

i have set rnvironment variable SIKULI_HOME properly still i do see this problem, all the JRE path , sikuli path set properly.
is there any work around for this .
can below sample code will help me out.

System.loadLibrary("Win32Util.dll")
Screen sikuli=new Screen();

or if there is any other workaround please let me know

Revision history for this message
RaiMan (raimund-hocke) wrote :

There is no workaround:

-- if SIKULI_HOME is set correctly, then Win32Util.dll will be found.

and

Screen sikuli=new Screen();

should work ([info] Windows utilities loaded should be printed on stdout).

The path entries are only needed for the other native libraries used e.g. with find and the Java awt support for the capture overlay window. Since you need at least a Screen object to start any Sikuli features, these are needed afterwards.

So you should again check your settings and the Sikuli installation on the failing machines.

Revision history for this message
Anton Feoktistov (anton-feoktistov) wrote :

Hi, had twice the same problem.

Installed on Win7 by instalator, Sikuli worked well, but after reboot got
[error] Can't create OS Util: org.sikuli.script.Win32Util
in Sikuli IDE

SIKULI_HOME was set correctly, PATH also was set. I didn't changed them. So, I reinstall Sikuli, and it worked for several days. Today I got again this error.
System variables were not touched by me

RaiMan (raimund-hocke)
Changed in sikuli:
status: New → Fix Committed
assignee: nobody → RaiMan (raimund-hocke)
milestone: none → x1.0
RaiMan (raimund-hocke)
tags: added: sikuliinit
Revision history for this message
chikori (infoallmidori) wrote :

I am also having this issue. I have my environment variables are set as below. Is there anything I can do /check to fix this issue?
I'm running Windows 7 64-bit OS

SIKULI_HOME: C:\Program Files (x86)\Sikuli X\
Path: c:\jruby-1.7.2\bin;C:\Program Files (x86)\Sikuli X\libs;C:\Program Files (x86)\Java\jre6\\bin
JAVA_HOME: C:\Program Files (x86)\Java\jdk1.6.0_39

Revision history for this message
RaiMan (raimund-hocke) wrote :

@chikori
When asking questions in bugs or questions, that are not yours, you should subscribe to this post (did it for you this time) or post your own question.

Do you really have a separate JRE 6 installed in C:\Program Files (x86)\Java\jre6 ?

JAVA_HOME currently does not help with Sikuli.

So Sikuli needs the path to jre6/bin to be in the system path.

In your case this might be
C:\Program Files (x86)\Java\jdk1.6.0_39\jre\bin

When I am right: change system path accordingly.

RaiMan (raimund-hocke)
tags: added: idestartup
removed: sikuliinit
RaiMan (raimund-hocke)
Changed in sikuli:
importance: Undecided → Critical
RaiMan (raimund-hocke)
Changed in sikuli:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.