[1.0.1] Windows: Java: "Fatal Error 110: loading: WinUtil.dll" when running from command prompt

Asked by Gulshansaini

Hello,

I am getting following error when running from batch file

==Recieved next Command 'openApp' with Target 'notepad.exe' and Value ''
Executing method 'openApp' with target 'notepad.exe' and value ''
openApp method called with target 'notepad.exe'
[error] ResourceLoaderBasic: loadLib: Fatal Error 110: loading: WinUtil.dll
[error] ResourceLoaderBasic: loadLib: Since native library was found, it might be a problem with needed dependent libraries
F:\workspace\Sikuli\lib\libs\WinUtil.dll: Can't find dependent libraries
[error] ResourceLoaderBasic: loadLib: Check, wether a valid Sikuli libs folder is in system path at runtime!
[error] Terminating SikuliX after a fatal error(110)! Sorry, but it makes no sense to continue!
If you do not have any idea about the error cause or solution, run again
with a Debug level of 3. You might paste the output to the Q&A board.
Press any key to continue . . .

This is how my batch file looks like :
@echo off
set CLASSPATH=
java -cp "lib/*" com.ists.sikuli.TestExecutor FileActions.xls FileFunctions TC20001
pause

com.ists.sikuli.TestExecutor is main class that takes three params i.e. file, sheet, and testcase name

here is how my main method looks like

public static void main(String[] args) throws Exception {
  if(args.length<2){
   throw new RuntimeException("Arguments less than 3 - Can not continue with execution");
  }
  String file = args[0];
  String sheet = args[1];
  String testCaseName = args[2];
  System.out.printf("Executing testcase %s defined in sheet %s and in file %s\n", args[2], args[1], args[0]);
  TestExecutor test = new TestExecutor();
  test.executeTestCase(file, sheet, testCaseName);
 }

When i run same thing from eclipse everything works perfectly.

I have following under lib
- my compiled jar
- sikuli-java.jar
- other jars not related to sikuli
- and sikuli libs folder

I can see "WinUtil.dll" file present under lib/libs/ folder

Please help me in resolving this issue.

Thanks
Gulshan

Question information

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

pls. run your batch again with java option
-Dsikuli.Debug=3

and paste the command line output here or send it silently to my mail at https://launchpad.net/~raimund-hocke, if you do not want it to be public.

Revision history for this message
akbar (mohammed-akbar-ali) said :
#2

Can you run the same by giving path for libs separately in classpath, -cp lib/*:lib/libs

Revision history for this message
Gulshansaini (gulshan-saini) said :
#3

Hi RaiMan,

Plese find below output with java option -Dsikuli.Debug=3

==Recieved next Command 'openApp' with Target 'notepad.exe' and Value ''
Executing method 'openApp' with target 'notepad.exe' and value ''
openApp method called with target 'notepad.exe'
[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/jre6/
[debug] ResourceLoaderBasic: check: Exists libs folder at location of jar? YES: F:/workspace/Sikuli/lib/
[debug] ResourceLoaderBasic: checkLibsDir: F:/workspace/Sikuli/lib/libs
[debug] ResourceLoaderBasic: loadLib: WinUtil
[debug] ResourceLoaderBasic: loadLib: Found: WinUtil
[error] ResourceLoaderBasic: loadLib: Fatal Error 110: loading: WinUtil.dll
[error] ResourceLoaderBasic: loadLib: Since native library was found, it might be a problem with needed dependent libraries
F:\workspace\Sikuli\lib\libs\WinUtil.dll: Can't find dependent libraries
[error] ResourceLoaderBasic: loadLib: Check, wether a valid Sikuli libs folder is in system path at runtime!
[error] Terminating SikuliX after a fatal error(110)! Sorry, but it makes no sense to continue!
If you do not have any idea about the error cause or solution, run again
with a Debug level of 3. You might paste the output to the Q&A board.
[debug] SikuliXFinal: cleanUp: 0
Press any key to continue . . .

Thanks
Gulshan

Revision history for this message
Gulshansaini (gulshan-saini) said :
#4

Hello Akbar,

Below is output

F:\workspace\Sikuli>java -cp "lib/*;lib/libs" com.ists.sikuli.TestExecutor FileActions.xls FileFunctions TC20001
Executing testcase TC20001 defined in sheet FileFunctions and in file FileActions.xls
==Recieved next Command 'openApp' with Target 'notepad.exe' and Value ''
Executing method 'openApp' with target 'notepad.exe' and value ''
openApp method called with target 'notepad.exe'
[error] ResourceLoaderBasic: loadLib: Fatal Error 110: loading: WinUtil.dll
[error] ResourceLoaderBasic: loadLib: Since native library was found, it might be a problem with needed dependent libraries
F:\workspace\Sikuli\lib\libs\WinUtil.dll: Can't find dependent libraries
[error] ResourceLoaderBasic: loadLib: Check, wether a valid Sikuli libs folder is in system path at runtime!
[error] Terminating SikuliX after a fatal error(110)! Sorry, but it makes no sense to continue!
If you do not have any idea about the error cause or solution, run again
with a Debug level of 3. You might paste the output to the Q&A board.

F:\workspace\Sikuli>pause
Press any key to continue . . .

Thanks
Gulshan

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

Ok, the problem is exactly, what Sikuli says:
Check, wether a valid Sikuli libs folder is in system path at runtime!

In Eclipse you seem to use references to the location, where you have setup sikuli.

Now you moved the sikuli stuff to your batch project folder. But now you have to take care, that the current libs folder is in system path at runtime, which is not the case currently.

the easiest and most flexible solution:

setup your batch as follows:

@echo off
setlocal
set CLASSPATH=
set PATH=%~dp0\lib\libs;%PATH%
java -cp "lib/*" com.ists.sikuli.TestExecutor FileActions.xls FileFunctions TC20001
endlocal
pause

this batch will run in any folder having the given folder structure inside and the batch on the first level.

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

I take this as a request bug, to further improve the libs handling.

BTW: You only need to copy the sikuli-java.jar around. With the above batch, Sikuli internally will finally decide to create a libs folder exactly in this place and copy the correct libs to this folder at runtime.

Revision history for this message
Gulshansaini (gulshan-saini) said :
#7

Hello RaiMan,

I am still getting same error after updating the batch file

Executing testcase TC20001 defined in sheet FileFunctions and in file FileActions.xls
==Recieved next Command 'openApp' with Target 'notepad.exe' and Value ''
Executing method 'openApp' with target 'notepad.exe' and value ''
openApp method called with target 'notepad.exe'
[debug] ResourceLoaderBasic: SikuliX Package Build: 1.0.1 12SEP2013135849
[debug] ResourceLoaderBasic: check: we are running on arch: amd64
[debug] ResourceLoaderBasic: check: using Java at: C:/Program Files/Java/jre6/
[debug] ResourceLoaderBasic: check: Exists libs folder at location of jar? YES: F:/workspace/Sikuli/lib/
[debug] ResourceLoaderBasic: checkLibsDir: F:/workspace/Sikuli/lib/libs
[debug] ResourceLoaderBasic: loadLib: WinUtil
[debug] ResourceLoaderBasic: loadLib: Found: WinUtil
[error] ResourceLoaderBasic: loadLib: Fatal Error 110: loading: WinUtil.dll
[error] ResourceLoaderBasic: loadLib: Since native library was found, it might be a problem with needed dependent libraries
F:\workspace\Sikuli\lib\libs\WinUtil.dll: Can't find dependent libraries
[error] ResourceLoaderBasic: loadLib: Check, wether a valid Sikuli libs folder is in system path at runtime!
[error] Terminating SikuliX after a fatal error(110)! Sorry, but it makes no sense to continue!
If you do not have any idea about the error cause or solution, run again
with a Debug level of 3. You might paste the output to the Q&A board.
[debug] SikuliXFinal: cleanUp: 0
Press any key to continue . . .

Please look at path set in user variables in following snapshot
http://tinypic.com/view.php?pic=hu4kn5&s=5#.UjrRgYaNkb0

Thanks
Gulshan

Revision history for this message
Gulshansaini (gulshan-saini) said :
#8

As per above error it says

[debug] ResourceLoaderBasic: loadLib: Found: WinUtil
[error] ResourceLoaderBasic: loadLib: Fatal Error 110: loading: WinUtil.dll

It look like it is having problem in loading WinUtil.dll

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

-- it look like it is having problem in loading WinUtil.dll
Of course, but it is because the libraries referenced in WinUtil are not found, which is definitely a problem of system path at runtime.

Have you somehow checked the system path in the moment of crash.

if not:

@echo off
setlocal
set CLASSPATH=
set PATH=%~dp0\lib\libs;%PATH%
echo %PATH%
java -cp "lib/*" com.ists.sikuli.TestExecutor FileActions.xls FileFunctions TC20001
endlocal
pause

and show the output here

Revision history for this message
Gulshansaini (gulshan-saini) said :
#10

Finally i was able to resolve this issue.

Steps I followed:
1. I removed Path from user settings
2. Deleted sikuli libs
3. run the batch file again
 - it generated libs directory again and also set user path on machine
4. did logout and login again as per prompt
5. run again batch file - and everything worked perfectly.

Revision history for this message
Gulshansaini (gulshan-saini) said :
#11

Thanks RaiMan for help :)

Revision history for this message
Gulshansaini (gulshan-saini) said :
#12

Thanks RaiMan, that solved my question.

Revision history for this message
Brian Brown (brizn) said :
#13

I'm getting the same error, but I have the environment set up correctly - I'm trying to run sikuli under Grinder - which works great on my Mac. Trying to get it going on Windows gives the WinUtil load error (later below is debug level 3).

I set up sikuli on the windows machine pack 1 and the IDE itself runs fine. The SIKULI_HOME environment variable is set for the whole system and the %SIKULI_HOME%\libs folder is in the system (not user) path. I have tried several things:

1. Add the sikuli-ide.jar to the classpath but leave it in the SIKULI_HOME folder.
2. Copy the sikuli-ide.jar locally (.\local-libs\) and add it to the classpath from there, as well as have ".\local-libs\libs" in the user path.

Both have the same error - I print out the PATH environ as seen by my jython script right before I attempt: from sikuli import *

output:
2013-12-26 12:54:38,242 INFO agent: Worker process command line: java '-javaagent:C:\Apps\Grinder\grinder-3.11\lib\grin
der-dcr-agent-3.11.jar' '-Dsikuli.Debug=3' -classpath 'C:\Apps\Grinder\local-libs\*;C:\Apps\Grinder\grinder-3.11\lib\gri
nder.jar' net.grinder.engine.process.WorkerProcessEntryPoint
2013-12-26 12:54:38,258 INFO agent: worker jmeter-win-1-1 started
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Apps\Groovy\Groov
y-2.2.1\bin;C:\Apps\SikuliX\libs;C:\Program Files\Java\jdk1.7.0_45\bin;C:\Apps\SikuliX\libs\;C:\Apps\Grinder\local-libs\
libs\
[debug] Jython: sikuli: __init__: entering
[debug] Jython: sikuli: Sikuli: entering
[debug] Jython: sikuli: Sikuli: constants
[debug] Jython: sikuli: Sikuli: import Region
[debug] Jython: sikuli: Sikuli: import Screen
[debug] Jython: sikuli: Sikuli: Env.addHotkey
[debug] Jython: sikuli: Sikuli: import Match
[debug] Jython: sikuli: Sikuli: import Pattern
[debug] Jython: sikuli: Sikuli: import Location
[debug] Jython: sikuli: Sikuli: import ScreenUnion
[debug] Jython: sikuli: Sikuli: import Finder
[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/jre7/
[debug] ResourceLoaderBasic: check: Exists libs folder at location of jar? YES: C:/Apps/Grinder/local-libs/
[debug] ResourceLoaderBasic: checkLibsDir: C:/Apps/Grinder/local-libs/libs
[debug] ResourceLoaderBasic: loadLib: WinUtil
[debug] ResourceLoaderBasic: loadLib: Found: WinUtil
[error] ResourceLoaderBasic: loadLib: Fatal Error 110: loading: WinUtil.dll
[error] ResourceLoaderBasic: loadLib: Since native library was found, it might be a problem with needed dependent librar
ies
C:\Apps\Grinder\local-libs\libs\WinUtil.dll: Can't find dependent libraries
[error] ResourceLoaderBasic: loadLib: Check, wether a valid Sikuli libs folder is in system path at runtime!
[error] Terminating SikuliX after a fatal error(110)! Sorry, but it makes no sense to continue!
If you do not have any idea about the error cause or solution, run again
with a Debug level of 3. You might paste the output to the Q&A board.
[debug] SikuliXFinal: cleanUp: 0

Revision history for this message
Brian Brown (brizn) said :
#14

Ok, I figured it out - I used dependency walker to see what DLL was not found by WinUtil.dll and it turned out to be: AWT.DLL

I had %JAVA_HOME%\bin in the path, but not %JAVA_HOME%\jre\bin - which is where the dll is.

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

@Brian Brown

--1: it is SIKULIX_HOME ...
... with version 1.0+ to allow some coexistence with RC3.
... and it is not needed in 99%

It is strongly recommended to not move around the Sikuli stuff (especially on Windows because of the libs path challenge).
Keep it in one folder (e.g. c:\SikuliX). When running any of the Sikuli packages, the environment is checked, the libs are exported from the jar to a libs folder preferably in the same folder as the jar itself and on Windows the path is setup in the registry if needed.

So if you keep it simple this way, you do not have to do anything, but run the setup and in doubt check, wether the system path is setup correctly.

--2: jawt.dll
... to avoid this additional entry %JAVA_HOME%\jre\bin in the system path only for this one lib, jawt.dll is now (1.0+) copied to the Sikuli X libs folder at startup, so it is found without this additional entry. ( a system path entry for Java is not needed any way in the system path and is in doubt blocking the dynamic switching of Java versions - only a JAVA_HOME in the system environment might be needed for some applications)

-- Conclusion
- SIKULI_HOME is not recognised by SikuliX 1.0.1 anyway
- SIKULIX_HOME is not needed, as long as you allow Sikuli to create and setup the libs folder in the same folder as the active jar
- a system/user path entry is created by Sikuli automatically
- a %JAVA_HOME%\jre\bin in the system path is not needed any longer (and not recommended)

Revision history for this message
Brian Brown (brizn) said :
#16

Thanks for the information.

When I first set it up, I had no Sikuli environment variable and referenced the jar file in the Sikuli install folder. The problem was the AWT.dll, not anything else. The jawt.dll that you reference was in the SikuliX/libs folder, but that didn't seem to fix the dependency problem. Only when I added %JAVA_HOME%\jre\bin to the path did it start to work.

I'll keep experimenting.

Revision history for this message
Brian Brown (brizn) said :
#17

Ok, I reset everything and here is what I found out.

My SikuliX folder is C:\Apps\SikuliX

1. I added sikuli-ide.jar to my grinder script classpath
2. I took %JAVA_HOME%\jre\bin out of the PATH
3. I made sure that C:\Apps\SikuliX\libs was in the PATH
4. Removed all reference to SIKULI_HOME (which of course didn't do anything anyway, since I spelled it wrong!)

Upon running the script, I received the same error as before - Unsatisfied dependency trying to load WinUtil.dll. I copied %JAVA_HOME%\jre\bin\awt.dll to C:\Apps\SikuliX\libs and the problem went away. Again, jawt.dll was in the C:\Apps\SikuliX\libs folder the whole time.

Does that shed some light on what is happening?

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

@Brian
The only possible reason for this is, that Sikuli grabs the jawt.dll internally from a different Java, then you are pointing to with JAVA_HOME.

Is it Windows 64-Bit?

You might add -Dsikuli.Debug=3 to the java command line, which will produce more debug output from Sikuli.

Revision history for this message
Brian Brown (brizn) said :
#19

Yes, it is windows 64-bit and comment #13 above has the output of -Dsikuli.Debug=3. Are you saying there is a mismatch between the internally provided dlls that come with Sikuli and the version of Java I have installed on the system?

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

ok, I did not go back to comment #13, sorry ;-)

Sikuli detects the Java version and from where Java is loaded:
a 64-Bit Java from C:/Program Files/Java/jre7/

But now from comment #13 I see this:
...... ;C:\Apps\SikuliX\libs;C:\Program Files\Java\jdk1.7.0_45\bin;C:\Apps\SikuliX\libs\;C:\Apps\Grinder\local-libs\
libs\
which seems to be the system path.

It should only be this:
...... ;C:\Apps\Grinder\local-libs\libs\

supposing that the used sikuli-ide.jar seems to be in C:\Apps\Grinder\local-libs

the other libs folder comes before and might contain stuff, that collides with the running Sikuli

ONLY ONE Sikuli libs folder should be on system path at runtime and this should be the one fitting to the running Sikuli (Sikuli internally tries to support this, if not hindered by the user ;-)