Problem

V

Venkat

Hi All,

I am trying to write a simple program in Java using JNI, the program has to
load a C++ interface using JNI.
I am getting the following error, could someone help me out in resolving
this error.

java.lang.UnsatisfiedLinkError: no hello.dll in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1491)
at java.lang.Runtime.loadLibrary0(Runtime.java:788)
at java.lang.System.loadLibrary(System.java:834)
at examples.texteditor.HelloWorld.<clinit>(HelloWorld.java:21)
Exception in thread "main"

I had installed JDK 1.4.2 and J2EE 1.4 SDK on my machine.


Thanks,
Venkat
 
C

Chris Smith

Venkat said:
java.lang.UnsatisfiedLinkError: no hello.dll in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1491)
at java.lang.Runtime.loadLibrary0(Runtime.java:788)
at java.lang.System.loadLibrary(System.java:834)
at examples.texteditor.HelloWorld.<clinit>(HelloWorld.java:21)
Exception in thread "main"

I had installed JDK 1.4.2 and J2EE 1.4 SDK on my machine.

The problem is that there is no hello.dll in java.library.path. Where
is hello.dll, and what does the line of code look like where you load
it? What is the output of System.getProperty("java.library.path")?

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
V

Venkat

The problem is that there is no hello.dll in java.library.path. Where
is hello.dll, and what does the line of code look like where you load
it? What is the output of System.getProperty("java.library.path")?

Hi Chris,

The Java File is as follows:

/*
* Class.java
*
* Created on July 9, 2004, 10:19 AM
*/


package examples.texteditor;
import java.io.*;

/**
*
* @author amaller
*/
public class HelloWorld {

public native void displayHelloWorld();

static
{
System.out.print(System.getProperty("java.library.path"));
System.loadLibrary("hello.dll");
}

public static void main(String ars[])
{
new HelloWorld().displayHelloWorld();
/* System.out.print("Hi Test");*/
}
/** Creates a new instance of Class */

}

Java.library.Path is
'C:\j2sdk1.4.2_04\jre\bin;.;C:\WINNT\system32;C:\WINNT;D:\Perl\bin\;C:\WINNT
\system32;C:\WINNT;C:\WINNT\System32\Wbem;d:\Program
Files\ClearCase\bin;C:\Program Files\Microsoft SQL
Server\80\Tools\BINN;C:\j2sdk1.4.2_04\bin;C:\j2sdk1.4.2_04\lib;C:\j2sdk1.4.2
_04\jre;C:\j2sdk1.4.2_04\include;C:\Sun\AppServer\bin;D:\Perl\bin\;C:\WINNT\
system32;C:\WINNT;C:\WINNT\System32\Wbem;d:\Program
Files\ClearCase\bin;C:\Program Files\Microsoft SQL
Server\80\Tools\BINN;C:\j2sdk1.4.2_04\bin'

I had placed the hello.dll into 'C:\j2sdk1.4.2_04\jre\bin' and still it
gives error.

Any idea on how can i get rid of this error.


Thanks,
Venkat
 
C

Chris Smith

Venkat said:
The Java File is as follows:
[...]
System.loadLibrary("hello.dll");

That should be System.loadLibrary("hello"). The point of loadLibrary is
to use a system-independent library name. For example,
loadLibrary("hello") will load hello.dll on a Windows system, but will
load libhello.so instead on a typical UNIX system. I don't know what
will happen when you pass "hello.dll" to loadLibrary; very likely, it's
looking for a library called "hello.dll.dll", and on a UNIX system it
would look for "libhello.dll.so". Neither of those are likely to exist
in their respective environments.

Everything else looks like it should work.

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,192
Latest member
KalaReid2

Latest Threads

Top