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

cljacobsen at gmail.com cljacobsen at gmail.com
Fri Jul 9 14:06:07 BST 2010


On 9 July 2010 07:00, Dave Gilmore <gilmorenator at gmail.com> wrote:
> 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

It is a bit hard to tell what the error is without having the entire
file layout hanging around. Could you put up a zip file somewhere or
perhaps just commit thing to a winupdater directory in the repos?

But I'd think that you might be naming your package kroc.winsparkle
but not putting it in the appropriate directory structure for that?
Check the macupdater code to see how I've named the package and
created the corresponding dir structure. Also the naming conventions
for packages [1] states that they "should [start with] one of the
top-level domain names, currently com, edu, gov, mil, net, org, or one
of the English two-letter codes identifying countries". Check the
package structure of the macupdater to see if you can copy that and
make things work.


> 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

Don't know what this could be off the top of my head. Though we need a
standalone ant script for compilation (again see the macupdater, in
particular build.xml). There will of course be some differences in the
command line for building the native windows bits (in the
native-compile target in build.xml), but if you commit what you've got
I can look at that.


> 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'd need to check things here, not done enough JNI stuff to give you
an answer to that. Of course you could just do like the macupdater and
implement as little in Java as possible, to avoid parameter passing :)
The macupdater is able to pull out all the relevant information from
the .app bundle so that pretty much no settings have to be set
manually, I don't think this will be the case in Windows though.


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

On windows I usually use notepad2 [2] and the command prompt :) At
least for the macupdater. I do use eclipse for the occplug development
but, eclipse/netbeans might be a bit overkill for the updater code!


Hope that helps,
  Christian

[1] http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html
[2] http://www.flos-freeware.ch/notepad2.html




More information about the developers mailing list