🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.java.programmer
Article #323

Re: Yet another JNI problem

#323
From: Joseph Millar
Date: Mon, 03 Aug 1998 00:00
38 lines
2529 bytes
Editions Vigdor <contact@vigdor.com> wrote:
[snip!]
> The code compiles (with CodeWarrior 3) to a 1 kb Registres.dll. The java
> code seems to find this dll (i.e. no UnsatisfiedLinkException during the
> initialization) but as soon as I try to use either setKey or getKey, an
> UnsatisfiedLinkException is thrown without message.

If the exception is thrown on the call to the native
method, then it's not a DLL finding or loading problem,
but either a construction or JVM restriction problem.

The code you posted looks good in terms of names and
general format.  I have no experience with CodeWarrior,
but if you dump the exported entrypoints in the DLL,
do the Java native method functions show and do they
have the correct names (ie. no preceding "_" or funny
trailing chars)?  Using MSVC++ compiler, this is done
using "dumpbin /exports name.dll".

Where is the class loaded from when it calls the native
method?  If the class has a classloader, the native
method will fail explicitly due to a hard wired check
in the JVM.

> I have tried putting Registres.dll in the directories Windows,
> Windows\System, Windows\System32, in the directory of the .class files
> and in the directory of the final output file. 

From your post, the DLL is loading fine.  If it wasn't
found, the exception would be on the loadLibrary()
call.  And the DLL should be somewhere in the PATH or
one of the dirs searched by default (ie. exe dir, cwd, 
etc).

--Joe
_____________________________________________________________________
Joseph A. Millar      Sr. Software Engineer     Iris Associates, Inc.
<jmillar@iris.com>                                http://www.iris.com
Technical Details
Message-ID: <35c61c33.849681056@news0.iris.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <35C59F50.F364A41C@vigdor.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,afeb4629d7eb96b
X-Google-Attributes: gid1089d0,public
X-Google-Thread: f74b3,afeb4629d7eb96b
X-Google-Attributes: gidf74b3,public
X-Google-Thread: 10a146,afeb4629d7eb96b
X-Google-Attributes: gid10a146,public
X-Google-Thread: 113ae9,afeb4629d7eb96b
X-Google-Attributes: gid113ae9,public
From: jmillar@iris.com (Joseph Millar)
Subject: Re: Yet another JNI problem
Date: 1998/08/03
Message-ID: <35c61c33.849681056@news0.iris.com>
X-Deja-AN: 377599848
Content-Transfer-Encoding: 7bit
References: <35C59F50.F364A41C@vigdor.com>
Content-Type: text/plain; charset=us-ascii
Organization: Iris Associates, Inc.
Mime-Version: 1.0
Newsgroups: comp.lang.java.programmer,comp.lang.java.help,borland.public.jbuilder.java.language,borland.public.jbuilder.java.api