This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug java/12940] New: GCJ 3.3.1 on Windows 2002 - java.lang.System.loadLibrary("JniLayer"); does not work at runtime.
- From: "canutf at cadence dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 Nov 2003 11:11:46 -0000
- Subject: [Bug java/12940] New: GCJ 3.3.1 on Windows 2002 - java.lang.System.loadLibrary("JniLayer"); does not work at runtime.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12940
Summary: GCJ 3.3.1 on Windows 2002 -
java.lang.System.loadLibrary("JniLayer"); does not work
at runtime.
Product: gcc
Version: 3.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: java
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: canutf at cadence dot com
CC: gcc-bugs at gcc dot gnu dot org
I developed a java software with a JNI layer. This java software is built and
released only for Windows platforms
The JNI layer is built with CL (Microsoft compiler). It produced a dll. Letâ??s
call it JniLayer.dll.
Everything is working fine with the JVM (i.e. java) delivered by SUN.
Note: JniLayer.dll is in a folder pointed by the PATH environment variable.
For performance reason, I would like to use GCJ to compile my java code to a
Win32 executable without touching my JNI layer. I believe that it is possible by
using the GCJ â??fjni option.
Iâ??m able to produce my Win32 executable. Letâ??s called it MyProg.exe.
When I run MyProg.exe I got this following exception : Exception in thread
"main" java.lang.UnsatisfiedLinkError: JniLayer: file not found.
I tried:
- to put JniLayer.dll into the current working directory (where MyProg.exe is
executed)
- to put JniLayer.dll where MyProg.exe reside on the file system.
- When I compiled MyProg.exe with gcj, I added the property
â??Djava.library.path=. to force MyProg.exe to find JniLayer.dll in the current
working directory.
- I create a LD_LIBRARY_PATH environment variable to point to the current
working directory. (Where is JniLayer.dll)
For all these tries I got always the same exception (i.e. Exception in thread
"main" java.lang.UnsatisfiedLinkError: JniLayer: file not found.)
What should I do to make it working?
Note: here is the peace of code loading the JniLayer.dll
...
public class CJniLayerWrapper {
/* a "JniLayer.dll" SHOULD EXIST in the PATH Env. Var. */
static {
java.lang.System.loadLibrary("JniLayer");
}
...
}
Thanks in advance for your help.
Best regards,
FRED.