JNI with embedded C++

Discussion in 'Java' started by james d., Oct 16, 2003.

  1. james d.

    james d. Guest

    Has anyone had any experience with this? I use MS Embedded Vis. C++ to
    produce a .dll file (that I then attempt to load using JNI) however all I
    get is errors.

    ANY help would be appreciated.


    C:\Program Files\Microsoft eMbedded C++
    4.0\Common\EVC\MyProjects\HelloWorld>java HelloWorld
    Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Program
    Files\Microsoft eMbedded C++
    4.0\Common\EVC\MyProjects\HelloWorld\HelloWorld.dll: Can't find dependent
    libraries
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1473)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1397)
    at java.lang.Runtime.loadLibrary0(Runtime.java:788)
    at java.lang.System.loadLibrary(System.java:832)
    at HelloWorld.<clinit>(HelloWorld.java:6)
    james d., Oct 16, 2003
    #1
    1. Advertising

  2. james d.

    Roedy Green Guest

    On Wed, 15 Oct 2003 23:45:21 -0400, "james d." <>
    wrote or quoted :

    > I use MS Embedded Vis. C++ to
    >produce a .dll file (that I then attempt to load using JNI) however all I
    >get is errors.
    >
    >ANY help would be appreciated.

    see http://mindprod.com/jgloss/jni.html

    JNI is the tenth leading cause of premature baldness in North America.
    The biggest tip I can give you is to get your C++ stuff debugged with
    a standalone C++ test harness before you start hooking up the JNI.
    Do everything a tiny bit at a time, and then test.

    One alternative is to hire masochists who will do this sort of thing
    for money. Hint hint.

    --
    Canadian Mind Products, Roedy Green.
    Coaching, problem solving, economical contract programming.
    See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
    Roedy Green, Oct 16, 2003
    #2
    1. Advertising

  3. james d.

    james d. Guest

    Actually, this helps alot. The lack of support for JNI out there is
    amazing... If you can help with my next question, it would be much
    appreciated.

    When I use MS Embedded Visual C++ to build my .dll (WCE Dynamic-Link
    Library), I have the option to create a .lib file. What does the .lib file
    do and is it necessary to have when executing my .dll?

    Thank again,
    James


    "Roedy Green" <> wrote in message
    news:...
    > On Wed, 15 Oct 2003 23:45:21 -0400, "james d." <>
    > wrote or quoted :
    >
    > > I use MS Embedded Vis. C++ to
    > >produce a .dll file (that I then attempt to load using JNI) however all I
    > >get is errors.
    > >
    > >ANY help would be appreciated.

    > see http://mindprod.com/jgloss/jni.html
    >
    > JNI is the tenth leading cause of premature baldness in North America.
    > The biggest tip I can give you is to get your C++ stuff debugged with
    > a standalone C++ test harness before you start hooking up the JNI.
    > Do everything a tiny bit at a time, and then test.
    >
    > One alternative is to hire masochists who will do this sort of thing
    > for money. Hint hint.
    >
    > --
    > Canadian Mind Products, Roedy Green.
    > Coaching, problem solving, economical contract programming.
    > See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
    james d., Oct 16, 2003
    #3
  4. Pssst: http://www.codeproject.com/useritems/jnibasics1.asp?target=JNI

    Also do a search at code project for other articles on the same subject.

    ---
    Regards,
    Millian Brave <>


    "james d." <> skrev i melding
    news:bml49c$mvt$...
    > Has anyone had any experience with this? I use MS Embedded Vis. C++ to
    > produce a .dll file (that I then attempt to load using JNI) however all I
    > get is errors.
    >
    > ANY help would be appreciated.
    >
    >
    > C:\Program Files\Microsoft eMbedded C++
    > 4.0\Common\EVC\MyProjects\HelloWorld>java HelloWorld
    > Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Program
    > Files\Microsoft eMbedded C++
    > 4.0\Common\EVC\MyProjects\HelloWorld\HelloWorld.dll: Can't find dependent
    > libraries
    > at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    > at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1473)
    > at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1397)
    > at java.lang.Runtime.loadLibrary0(Runtime.java:788)
    > at java.lang.System.loadLibrary(System.java:832)
    > at HelloWorld.<clinit>(HelloWorld.java:6)
    >
    >
    Millian Brave, Oct 16, 2003
    #4
  5. james d.

    Chris Uppal Guest

    james d. wrote:

    > When I use MS Embedded Visual C++ to build my .dll (WCE Dynamic-Link
    > Library), I have the option to create a .lib file. What does the .lib
    > file do and is it necessary to have when executing my .dll?


    For your purposes it can be ignored.

    It's just a stub *static* library that internally links to the dynamic library,
    the idea is that another C(ish) program can be statically linked with the stub
    so that the program uses the DLL without the programmer having to code for
    loading it and finding the entrypoints at runtime.

    The Java runtime knows all about dynamic loading of DLLs so the .lib file is
    irrelevant for JNI users.

    -- chris
    Chris Uppal, Oct 17, 2003
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex Hunsley

    IBM's JNI fails where Sun's JNI works

    Alex Hunsley, Nov 3, 2003, in forum: Java
    Replies:
    4
    Views:
    835
    Alex Hunsley
    Nov 4, 2003
  2. Pasturel Jean-Louis

    Porting JNI Windows under JNI LINUX + Wine ?

    Pasturel Jean-Louis, Feb 29, 2004, in forum: Java
    Replies:
    5
    Views:
    890
    Pasturel Jean-Louis
    Mar 3, 2004
  3. vasanth
    Replies:
    0
    Views:
    2,660
    vasanth
    Jan 25, 2005
  4. vasanth
    Replies:
    0
    Views:
    606
    vasanth
    Jan 25, 2005
  5. bgabrhelik
    Replies:
    0
    Views:
    784
    bgabrhelik
    Sep 29, 2009
Loading...

Share This Page