Article View: borland.public.jbuilder.java.language
Article #689Re: Calling a dll func from Java
From: Kevin Dean [TeamB]
Date: Fri, 25 Feb 2005 22:56
Date: Fri, 25 Feb 2005 22:56
54 lines
2763 bytes
2763 bytes
Chris Lafferty wrote:
> Kevin,
>
> I am having a similar problem. I have done what you suggested below,
> adding the -Djava.library.path= to the location of the .DLL. It
> seems more like it cannot find the function inside the DLL as opposed
> to the DLL itself as before I copied the DLL to that location, the
> error described the DLL name instead of the funciton. I wrote a test
> DLL and was able to call it from Delphi, so I know the methods are
> public and exported properly. However, when I run from java, I get
> the same error as yc did. Here is my code and error:
>
> public class DLLBridge
> {
> public DLLBridge() {
> }
> public native void RprtMain();
>
> static{
> System.loadLibrary("Reports");
> }
>
> public static void main(String[] args) {
> DLLBridge dbridge = new DLLBridge();
> dbridge.RprtMain();
> }
> }
>
> java.lang.UnsatisfiedLinkError: RprtMain
> at com.util.DLLBridge.RprtMain(Native Method)
> at com.util.DLLBridge.main(DLLBridge.java:21)
> Exception in thread "main"
>
> Is there something I'm missing? Thanks in advance,
> Chris
The post from Alexey is likely to be more correct than the one I have
given you. I'm not intimately familiar with JNI and so gave the answer
that solves about 90% of the JNI questions we get. Have you done what
Alexey suggests?
--
Kevin Dean [TeamB]
Dolphin Data Development Ltd.
http://www.datadevelopment.com/
NEW WHITEPAPERS
Team Development with JBuilder and Borland Enterprise Server
Securing Borland Enterprise Server
http://www.datadevelopment.com/papers/index.html
Please see Borland's newsgroup guidelines at
http://info.borland.com/newsgroups/guide.html
Technical Details
Message-ID:
<xn0dyxhy5p2f42000-kdean@www.teamb.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<421eedd1$2@newsgroups.borland.com> <xn0dyx2iu419bb001-kdean@www.teamb.com> <421f8461$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: f74b3,a69aa8c14ff32559
X-Google-Attributes: gidf74b3,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Kevin Dean [TeamB]" <NkOdSePaAnM@datadevelopment.com>
Subject: Re: Calling a dll func from Java
Newsgroups: borland.public.jbuilder.java.language
References: <421eedd1$2@newsgroups.borland.com> <xn0dyx2iu419bb001-kdean@www.teamb.com> <421f8461$1@newsgroups.borland.com>
Organization: Dolphin Data Development Ltd.
User-Agent: XanaNews/1.17.2.7
X-Face: ":yn4zt^A_dn>6~{YJmu^B\'4w)e:apPM\VC=Dvf&*tASxX9|BYczkFd$xr.$vNSZ[3Uobr
p]c4\+\l){!WQI.$]veP({HLd;CDYH?iN
Message-ID: <xn0dyxhy5p2f42000-kdean@www.teamb.com>
X-Ref: newsgroups.borland.com ~XNS:000000EB
NNTP-Posting-Host: 24.57.153.235
Date: 25 Feb 2005 14:56:57 -0800
X-Trace: newsgroups.borland.com 1109372217 24.57.153.235 (25 Feb 2005 14:56:57 -0800)
Lines: 54
X-Authenticated-User: kdean
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail