Applet with JNI

Discussion in 'Java' started by Uli Kunkel, Nov 20, 2008.

  1. Uli Kunkel

    Uli Kunkel Guest

    I'm developing an applet that calls a wrapper c++ dll using JNI.
    The wrapper dll itself uses some other dlls.
    Applet---Wrapper DLL----Other DLLs

    This "Other DLLs" have to be in my java_home/bin directory to be called
    correctly.
    What I want is to create a jar that will contain them all.
    I'm currently loading the Wrapper Dll whit System.load(path_to_dll).

    Can I include this dlls in my project and have them in one jar file or
    I'll have to put them in the system path instead?

    Thanks in advance for any suggestions.
    Uli Kunkel, Nov 20, 2008
    #1
    1. Advertising

  2. On Nov 20, 9:06 pm, Sabine Dinis Blochberger <>
    wrote:
    ....
    > When using JWS, each native library gets it's own jar.


    There is no rule to that effect. Since JWS downloads
    natives eagerly, it makes no point to split them up
    beyond jar's for each platform.

    --
    Andrew Thompson
    http://pscode.org/
    Andrew Thompson, Nov 20, 2008
    #2
    1. Advertising

  3. Uli Kunkel

    Arne Vajhøj Guest

    Uli Kunkel wrote:
    > I'm developing an applet that calls a wrapper c++ dll using JNI.
    > The wrapper dll itself uses some other dlls.
    > Applet---Wrapper DLL----Other DLLs
    >
    > This "Other DLLs" have to be in my java_home/bin directory to be called
    > correctly.
    > What I want is to create a jar that will contain them all.
    > I'm currently loading the Wrapper Dll whit System.load(path_to_dll).
    >
    > Can I include this dlls in my project and have them in one jar file or
    > I'll have to put them in the system path instead?


    Applet: no.

    JWS: see the other replies.

    Arne
    Arne Vajhøj, Nov 21, 2008
    #3
  4. On Nov 21, 8:34 pm, Sabine Dinis Blochberger <>
    wrote:
    > Andrew Thompson wrote:
    > > On Nov 20, 9:06 pm, Sabine Dinis Blochberger <>
    > > wrote:
    > > ....
    > > > When using JWS, each native library gets it's own jar.

    >
    > > There is no rule to that effect.  Since JWS downloads
    > > natives eagerly, it makes no point to split them up
    > > beyond jar's for each platform.

    >
    > Well, yes, that's right. In my case, we have to sign our application, so
    > that's in my brain.
    >
    > When you need to sign it, then you have to jar them in order to be able
    > to sign them.


    True, but since that is not directly related to
    what I was mentioning, I think we are talking at
    'cross-purposes'.

    I simply meant that if you had a project with 4
    Win DLLs, 3 *nix style .so's, and no natives for Mac,
    you might end up with 3 Jar files in total.

    The 'pure java' component that all platforms get
    in one jar, and one jar of 'natives' for each of
    Win and *nix.

    Of course, you could even reduce that to just two
    Jar's - one containing both flavors of native, but
    that means an extra (redundant) download hit for
    each platform.

    --
    Andrew Thompson
    http://pscode.org/
    Andrew Thompson, Nov 21, 2008
    #4
  5. Uli Kunkel

    Uli Kunkel Guest

    Uli Kunkel wrote:
    > I'm developing an applet that calls a wrapper c++ dll using JNI.
    > The wrapper dll itself uses some other dlls.
    > Applet---Wrapper DLL----Other DLLs
    >
    > This "Other DLLs" have to be in my java_home/bin directory to be called
    > correctly.
    > What I want is to create a jar that will contain them all.
    > I'm currently loading the Wrapper Dll whit System.load(path_to_dll).
    >
    > Can I include this dlls in my project and have them in one jar file or
    > I'll have to put them in the system path instead?
    >
    > Thanks in advance for any suggestions.


    Thank you all for the replays.
    For the time I tried just to copy the native dlls to the client.
    So I copied the WrapperDLL and OtherDLLs to "C:\AppletDLLs".

    The wrapper dll loads fine, but he cannot call Other DLLs.
    Where to put these "Other dlls"?


    p.s.During development I had to put these Other DLLs in
    java_home/jre/bin directory to work.
    If I don't use java then they are in the same directory as the exe or
    dll file..
    Uli Kunkel, Nov 21, 2008
    #5
  6. Uli Kunkel

    Roedy Green Guest

    On Thu, 20 Nov 2008 10:00:21 +0100, Uli Kunkel <>
    wrote, quoted or indirectly quoted someone who said :

    >I'm developing an applet that calls a wrapper c++ dll using JNI.
    >The wrapper dll itself uses some other dlls.
    >Applet---Wrapper DLL----Other DLLs
    >
    >This "Other DLLs" have to be in my java_home/bin directory to be called
    >correctly.
    >What I want is to create a jar that will contain them all.
    >I'm currently loading the Wrapper Dll whit System.load(path_to_dll).
    >
    >Can I include this dlls in my project and have them in one jar file or
    >I'll have to put them in the system path instead?
    >
    >Thanks in advance for any suggestions.


    This is a nightmare. Use Java Web Start instead. It will deal with
    installing the DLL files somewhere on the library path for you and
    later uninstalling them.

    There is a feature of JWS for launching Applets. It may be suitable
    combo for both approaches.
    --
    Roedy Green Canadian Mind Products
    http://mindprod.com
    Your old road is
    Rapidly agin'.
    Please get out of the new one
    If you can't lend your hand
    For the times they are a-changin'.
    Roedy Green, Nov 21, 2008
    #6
  7. Uli Kunkel

    Uli Kunkel Guest

    Roedy Green wrote:
    > On Thu, 20 Nov 2008 10:00:21 +0100, Uli Kunkel <>
    > wrote, quoted or indirectly quoted someone who said :
    >
    >> I'm developing an applet that calls a wrapper c++ dll using JNI.
    >> The wrapper dll itself uses some other dlls.
    >> Applet---Wrapper DLL----Other DLLs
    >>
    >> This "Other DLLs" have to be in my java_home/bin directory to be called
    >> correctly.
    >> What I want is to create a jar that will contain them all.
    >> I'm currently loading the Wrapper Dll whit System.load(path_to_dll).
    >>
    >> Can I include this dlls in my project and have them in one jar file or
    >> I'll have to put them in the system path instead?
    >>
    >> Thanks in advance for any suggestions.

    >
    > This is a nightmare. Use Java Web Start instead. It will deal with
    > installing the DLL files somewhere on the library path for you and
    > later uninstalling them.
    >
    > There is a feature of JWS for launching Applets. It may be suitable
    > combo for both approaches.


    It works now.
    These Other DLLs had to be in system folder.
    I think I should put all the dlls in the system folder and preinstall
    them because there are going to be just a couple of client machines.
    Uli Kunkel, Nov 21, 2008
    #7
  8. Uli Kunkel

    Uli Kunkel Guest

    Sabine Dinis Blochberger wrote:
    > Uli Kunkel wrote:
    >
    >> It works now.
    >> These Other DLLs had to be in system folder.
    >> I think I should put all the dlls in the system folder and preinstall
    >> them because there are going to be just a couple of client machines.

    >
    > What's this "system folder"? Like \Windows\system32 ? If it is then
    > *that* is a nightmare.
    >
    > It reminds me of computer games (or applications in many cases) that
    > were written using MS VC++ - then they forget that not every user has
    > that IDE, and don't package the dlls with their application, making it
    > impossible to use. Thank the internet, you can get those frakking dlls
    > anyway.
    >
    > I prefer keeping libraries with each application. These days, disk space
    > is no problem. And you avoid dll hell.


    Yes it is \WINDOWS\system32.
    I also tried to put the path to the dlls to the path environment
    variable but that didn't work.
    System folder was the only thing that worked.
    Uli Kunkel, Nov 24, 2008
    #8
    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:
    847
    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:
    902
    Pasturel Jean-Louis
    Mar 3, 2004
  3. vasanth
    Replies:
    0
    Views:
    2,685
    vasanth
    Jan 25, 2005
  4. vasanth
    Replies:
    0
    Views:
    620
    vasanth
    Jan 25, 2005
  5. bgabrhelik
    Replies:
    0
    Views:
    802
    bgabrhelik
    Sep 29, 2009
Loading...

Share This Page