Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Applet with JNI

Reply
Thread Tools

Applet with JNI

 
 
Uli Kunkel
Guest
Posts: n/a
 
      11-20-2008
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.
 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      11-20-2008
On Nov 20, 9:06*pm, Sabine Dinis Blochberger <(E-Mail Removed)>
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/
 
Reply With Quote
 
 
 
 
Arne Vajh°j
Guest
Posts: n/a
 
      11-21-2008
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
 
Reply With Quote
 
Andrew Thompson
Guest
Posts: n/a
 
      11-21-2008
On Nov 21, 8:34*pm, Sabine Dinis Blochberger <(E-Mail Removed)>
wrote:
> Andrew Thompson wrote:
> > On Nov 20, 9:06 pm, Sabine Dinis Blochberger <(E-Mail Removed)>
> > 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/
 
Reply With Quote
 
Uli Kunkel
Guest
Posts: n/a
 
      11-21-2008
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..
 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      11-21-2008
On Thu, 20 Nov 2008 10:00:21 +0100, Uli Kunkel <(E-Mail Removed)>
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'.
 
Reply With Quote
 
Uli Kunkel
Guest
Posts: n/a
 
      11-21-2008
Roedy Green wrote:
> On Thu, 20 Nov 2008 10:00:21 +0100, Uli Kunkel <(E-Mail Removed)>
> 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.
 
Reply With Quote
 
Uli Kunkel
Guest
Posts: n/a
 
      11-24-2008
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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
JNI thread vs. native thread vs. JNI call bgabrhelik Java 0 09-29-2009 03:33 PM
Re: JNI: Error loading DLL from JNI DDL vasanth Java 0 01-25-2005 11:03 AM
Re: JNI: Error loading DLL from JNI DDL vasanth Java 0 01-25-2005 11:01 AM
Porting JNI Windows under JNI LINUX + Wine ? Pasturel Jean-Louis Java 5 03-03-2004 07:50 PM
IBM's JNI fails where Sun's JNI works Alex Hunsley Java 4 11-04-2003 10:34 AM



Advertisments