Article View: borland.public.jbuilder.java.api
Article #1272Re: basic JNI question
From: Owen Green
Date: Wed, 20 Mar 2002 18:22
Date: Wed, 20 Mar 2002 18:22
33 lines
2410 bytes
2410 bytes
Roger Woodward <rogerw@woodwardassoc.co.uk> wrote in message news:3c7e6bc5_2@dnews... > Simple question from a non Java person. > How does Java call functions residing either within a DLL or OCX component. For DLLs using JNI, for OCXs either using JNI or one of the available ActiveX / COM - Java bridges. > Is this a simple process and are there any obvious pitfalls. It's a bit of a messy process, IMO. The reccomended procdeure is to define your Java class, marking the desired methods as native and then run javah over the class file. This will produce a C header file for you, which obviously needs implementing. There is a Delphi translation of the JNI API available at JEDI (www.delphi-jedi.org) which lessens the pain if you don't happen to like C / C++ and can live with being restricted to Win / Linux, but it doesn't (yet) have an automatic interface generator :( > I know that JNI exists but nothing about it (Ive an idea that this is what I > need to investigate) so if you know of a good web reference as a starting > point for reading I would be very grateful. http://java.sun.com/docs/books/tutorial/native1.1/index.html http://java.sun.com/products/jdk/faq/jnifaq.html There is also some information in the standard SDK docs. Also, FWIW, I heard that some changes may have been made for JNI in JDK 1.4, but that may be a faulty memory (I haven't yet played with 1.4, the shame, the shame). hth Owen
Technical Details
Message-ID:
<3c98d202_2@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!supernews.com!newsfeed.wirehub.nl!newsfeed.media.kyoto-u.ac.jp!out.nntp.be!propagator-SanJose!in.nntp.be!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnewsReferences:
<3c7e6bc5_2@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,bc41267c05921d85 X-Google-Attributes: gid1089d0,public X-Google-ArrivalTime: 2002-03-20 10:25:40 PST From: "Owen Green" <owen@begonefoulmachine.kennulz.demon.co.uk> Newsgroups: borland.public.jbuilder.java.api References: <3c7e6bc5_2@dnews> Subject: Re: basic JNI question Date: Wed, 20 Mar 2002 18:22:13 -0000 Lines: 39 Organization: Unique Interactive X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 NNTP-Posting-Host: 217.134.125.238 Message-ID: <3c98d202_2@dnews> X-Trace: dnews 1016648194 217.134.125.238 (20 Mar 2002 10:16:34 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!supernews.com!newsfeed.wirehub.nl!newsfeed.media.kyoto-u.ac.jp!out.nntp.be!propagator-SanJose!in.nntp.be!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews