[CCC DEV] JNI - Native Calls to WinSparkle.dll

Dave Gilmore gilmorenator at gmail.com
Fri Jul 9 12:00:25 BST 2010


Hi Guys,

Please excuse my lack of experience in this matter - this is my first time
attempting to do anything with JNI,

I am attempting to implement the auto update feature for the Windows
distribution using WinSparkle [1],

It's api is written in C so we should be able to use this from any language
for reference the api code can be found at [2],

It's my first go at calling native methods from java using JNI and decided
to put together a quick and dirty test class before integrating into jedit.
The code can be found at [3].

I have a few problems when trying to execute the code - So here goes:

1) When I attempt to generate the header file - I get a message stating
"Illegal Package Name" - I have Googled the problem and tried some of the
suggested solutions but none of them seem to work :-( I'm using eclipse so
maybe if I used a different environment it would take care of this?
I'm currently running the javah -jni command from the command prompt

2) When attempting to build / run my simple class I get a
"java.lang.UnsatisfiedLinkError" from what I can tell this is usually
attributed to the development environment not being able to find the
library. I attempted to resolve this in eclipse by specifying the containing
folder of the dll, so it knows exactly where it lives. Another option would
be to use System.load() and specify the complete path. Perhaps it's also
linked to problem 1

3) On line 20 of [3] I'm passing the method a string when it expects a char
so I'll need to do some conversion unless there is an easier way...

I'll give a different dev environment a whirl and see if that resolves any
of the issues - I prefer netbeans anyway - sorry!

If anyone can shed any light on any of these issues that would be great -
please remember that this is my first attempt at something like this but I'm
learning a great deal from it :-)

Before asking here I have Googled what I can and also read up on JNI etc
this morning - I've been up since 06:00 (GMT+1) - Maybe I'm tired,

I'll update you all if I get it sorted - right now I'm off for a shower and
some Brunch - things (especially code) always seem different when you walk
away for a while,

Cheers,

Dave.
___
Dave Gilmore
[1] http://winsparkle.org/
[2] http://pastebin.com/zvtJNshf
[3] http://pastebin.com/QYhsnjv3







More information about the developers mailing list