Article View: borland.public.jbuilder.java.language
Article #8734Re: JNI in 1.1 and 1.2
From: John McGrath TeamB
Date: Thu, 01 Mar 2001 08:08
Date: Thu, 01 Mar 2001 08:08
50 lines
2917 bytes
2917 bytes
On Wed, 28 Feb 2001 18:13:45 +0200, Janne Johansson wrote:
> Is there any difference when using native interface in java 1.1
> and using it in 1.2?
There were quite a few changes. See the following:
http://java.sun.com/products/jdk/1.2/docs/guide/jni/jni-12.html
> I mean other, than System.loadLibrary call which in 1.1
> requires whole path to dll and in 1.2 only the dll name
> and expects to have the dll in path.
Are you sure about this? If I recall correctly, System.loadLibrary()
worked pretty much the same in 1.1 as it does in 1.3, and the JavaDoc
for loadLibrary() says pretty much the same thing in 1.1 and 1.3.
Are you aware that there are two different methods in the System class
that can be used to load a library? Perhaps you used load() and are
now confusing it with loadLibrary().
public static void loadLibrary(String libname)
Loads the system library specified by the libname
argument. The manner in which a library name is mapped
to the actual system library is system dependent.
public static void load(String filename)
Loads the specified filename as a dynamic library.
The filename argument must be a complete pathname.
BTW, loadLibrary() does not actually require that the DLL file be on
the path. The Windows Java runtime looks for DLLs in the directories
specified by the system property "java.library.path". The default
value for this property is pretty much the same locations that Windows
usually does, including the directory that contains the executable, the
PATH, the Windows system and system32 directories, and a few others.
Unfortumately, the "executable" when you are running a Java program is
"java.exe", so it is not very useful to load DLLs from the directory
that contains it. It would be nice if the DLL loading code would also
look in a directory based on where the classes were loaded from.
--
Regards,
John McGrath [TeamB]
---------------------------------------------------
Before sending me e-mail, please read:
http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID:
<MPG.1507cd51735bbbf1989fe5@forums.borland.com>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!hermes.visi.com!news-out.visi.com!news.maxwell.syr.edu!newsfeed1.uni2.dk!newssuck.uni2.dk!bornews.borland.com!not-for-mailReferences:
<3A9D23B9.79D8E404@datex-ohmeda.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,493d8818565add66 X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-03-01 00:22:04 PST Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!hermes.visi.com!news-out.visi.com!news.maxwell.syr.edu!newsfeed1.uni2.dk!newssuck.uni2.dk!bornews.borland.com!not-for-mail From: John McGrath [TeamB] <ng-b@JPMcGrath.net> Newsgroups: borland.public.jbuilder.java.language Subject: Re: JNI in 1.1 and 1.2 Date: Thu, 1 Mar 2001 03:08:06 -0500 Organization: Another Netscape Collabra Server User Lines: 50 Message-ID: <MPG.1507cd51735bbbf1989fe5@forums.borland.com> References: <3A9D23B9.79D8E404@datex-ohmeda.com> NNTP-Posting-Host: dslcv1-60.fast.net X-Newsreader: MicroPlanet Gravity v2.30