wood burning stoves 2.0*
The moose likes General Computing and the fly likes java. lang. UnsatisfiedLinkError Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » General Computing
Bookmark "java. lang. UnsatisfiedLinkError" Watch "java. lang. UnsatisfiedLinkError" New topic
Author

java. lang. UnsatisfiedLinkError

karolos ignatiadis
Greenhorn

Joined: Nov 15, 2003
Posts: 25
Hello,

I have the following problem:

When I execute "java main" a window pops up with the following error:

Microsoft Visual C++ Debug Library

Debug Assertion Failed!

Program: c:\j2sdk1.4.2_09\bin\java.exe
File: app3ds.cpp
Line:32 ASSERT(!afxContextIsDLL); // Should only be called by apps

If I press "Ignore" I then get a "java.lang.UnsatisfiedLinkError: D:\...\Hmi_HITDlg.dll: A
dynamic link library (DLL) initialization routine failed."

If I press "Retry" I get a java.lang.UnsatisfiedLinkError: D:\..Hmi_HITDlg.dll: One or more
arguments are invalid.

What I am actually trying to do is call a C++ function from Java using JNI (JNI code is generated using SWIG).

Here is my C++ function (in HMI_HITDlg.cpp):

-------------------------------------
float get_LongVel() {
return myInput.Vehicle.LongVel;
}
-------------------------------------

This is my JNI code (in HMI_HITDlg_wrap.cxx)

----------------------------------------------
JNIEXPORT jfloat JNICALL Java_Hmi_1HITDlgJNI_get_1LongVel(JNIEnv *jenv, jclass jcls) {
jfloat jresult = 0 ;
float result;

(void)jenv;
(void)jcls;
result = (float)get_LongVel();

jresult = (jfloat)result;
return jresult;
}
-----------------------------------------------

This is the code where I am loading the dynamic link library Hmi_HITDlg.dll (contains HMI_HITDlg.cpp and HMI_HITDlg_wrap.cxx
and other necessary files and is made using Visual C++ 6.0, from File->New->Projects->Win32 Dynamic-Link Library) in main.java:

-------------------------------------------------

System.loadLibrary("Hmi_HITDlg");


The size of the DLL that I am loading is approx. 2.04MB .

What is going on here? Please help!!
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

It sounds like your JDK install (or one of the libraries it uses) is corrupted - I'd try to delete and re-install and see if it helps.


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
jQuery in Action, 2nd edition
 
subject: java. lang. UnsatisfiedLinkError
 
Similar Threads
Access dll functions in java
JNI accessing Integer Object
Swig
UnsatisfiedLinkError in my first JNI program
JNI question - c++ objects (global?) and returning arrays