• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

java. lang. UnsatisfiedLinkError

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!!
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Wink, wink, nudge, nudge, say no more, it's a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic