Windows .NET integration with IKVM: Cannot Copy jawt.dll

Asked by Matt Hunter

Hi Raiman,

I have successfully installed sikuli and gotten it to work in Eclipse. My goal is to be able to use sikuli in the .NET framework. I used ikvm to wrap sikuli-java into a dll file. Then, when I attempt to use it in my C# code, I can use screen.type("foo") without any problem. However when I attempt to use Sikuli with images I am running into an error.

[error] ResourceLoaderBasic: checkLibsDir: Fatal error 107: problem copying jawt.dll
File not found
[error] Terminating SikuliX after a fatal error(107)! Sorry, but it makes no sense to continue!

The code I am running has the exact functionality as the code in Java:
if (screen.exists(windowsStartButtonPattern, 0.8) != null)
{ stuff }

I know that Sikuli wasn't developed for .NET, but I am hoping you might be able to tell me something about the way Sikuli works that would explain why it attempts to copy dll files when using images, where it attempts to put them, etc, and maybe even why the system is unable to copy the file.

I have thoroughly explored a lot of the options concerning C# and Sikuli including SikuliIntegrator and Sikuli4Net as well as free interop services between Java and C#, and I think that ikvm is my best option.

While poking around I vaguely remember seeing something that may have indicated that you guys are developing some sort of interface for .NET, so I thought I would just ask you here if you are.

Thanks for your time,
Matt

Question information

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

- 1. are we talking about SikuliX 1.0.1 sikuli-java.jar?

I am really interested in the setup. I already visited the IKVM site and had a good feeling, but not yet time to check further.

- 2. problem copying jawt.dll
The Sikuli dll WinUtil needs access to Java's jawt.dll. To not have the need for an extra system path entry (to the Java install), I decided to simply copy the jawt.dll at startup in any case to Sikuli's libs folder, which is in system path. The solution relies on the fact, that Sikuli is run with a valid Java JVM.
In your case, I guess Sikuli's internal evaluation of the Java environment either does not lead to a valid file path or the jawt.dll is simply not there where it should be in a standard Java installation.

So I am sorry to say: Since all this is hardcoded without any options to get around, I think, you do not have a chance, to get it running.

But I am really willing to get you on the road with that.
Since I am currently busy with 1.1.0-Beta3, I can offer you the following:
If you send me a mail silently to my mail at https://launchpad.net/~raimund-hocke, I can provide you with a sikulixapi.jar (the name of sikuli-java.jar beginning with 1.1.0) for your system, so you could test with that.

What you can do already now:
add sikuli.Debug=3 to the Java runtime environment (with java it would be a -D parameter) and you might get more information on Sikuli's startup actions. You might send this log to me also.

Revision history for this message
Matt Hunter (matthunter1217) said :
#2

Thank you for the quick reply!

I just sent you a message and am looking forward to trying again with the newer version.

I'll be sure to keep you and this thread updated on how this goes.

Thanks again,
Matt

Revision history for this message
Matt Hunter (matthunter1217) said :
#3

Hi Raiman,

Sorry I didn't get back to you sooner. Using Eclipse and Java, SikuliXApi works fine well.
When I use ikvm and try to run my program, I find that typing works but when trying to run screen.exists(image), I'm getting the follow error:

Terminating: The jar in use was not built with setup!
[path to sikulixapi.DLL]

Additionally, while converting the .jar ikvm reported that it couldn't find com.sun.jdi.CLASSNAME, if that's helpful to you at all.

Thanks again,
Matt

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

No problem ;-)

*** Terminating: The jar in use was not built with setup!
[path to sikulixapi.DLL]

Because of the complex setup situation on different systems with different Java's I have implement a bunch off checks, to avoid problem situations created by people not working along the recommended way of setup and usage.

This is one of them ;-)

I can fix that rather easy and additionally have the option by this, to know at this place, that sikulixapi is running in the IKVM wrapper.

Latest during Monday (European time) you can download from the nightly build page (http://nightly.sikuli.de) a fixed version of sikulixapi.jar (it is bigger, because it contains the native stuff for all systems, so I have to take care for only one artefact).

*** it couldn't find com.sun.jdi.CLASSNAME
I will check what that is and where it should come from.

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

To not just make a quick-and-dirty fix, it would help me, to have a list of the class path just before the first access to any SikuliX features in your sikulixapi.dll.

this is a code, that prints out the class path content at runtime, as it is seen by the class loader at that moment (the environment class path might not help, since I guess in your context the class path is managed dynamically at runtime):

import java.net.URL;
import java.net.URLClassLoader;

URLClassLoader sysLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();
URL[] urls = sysLoader.getURLs();
for (int i = 0; i < urls.length; i++) {
      System.out.printf("%d: %s\n", i, urls[i]);
}

please send me the output to my known mail.

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

*** com.sun.jdi. ....
seems to be some debugging support (Java Debug Interface)

I am not aware of that this is used or referenced in sikulixapi.jar

Revision history for this message
Matt Hunter (matthunter1217) said :
#7

Hi Raiman,

I was having troubles running the code, and after talking to one of the developers at IKVM, he told me, "Unfortunately, the best answer I can give is "there is no meaningful classpath"." I can tell you that any IKVM application must use IKVM's implementation of Java by referencing dlls called IKVM.OpenJDK.Core, IKVMOpenJDK.SwingAWT, etc.

If there is anything else I can help you with, please let me know.

Matt

Can you help with this problem?

Provide an answer of your own, or ask Matt Hunter for more information if necessary.

To post a message you must log in.