Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #8507
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nx02.iad01.newshosting.com!newshosting.com!69.16.185.16.MISMATCH!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!newsfe04.iad.POSTED!00000000!not-for-mail |
|---|---|
| From | Owen Jacobson <angrybaldguy@gmail.com> |
| Newsgroups | comp.lang.java.programmer |
| Message-ID | <201110032353253223-angrybaldguy@gmailcom> (permalink) |
| References | <j6d70q$24c$1@online.de> |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=iso-8859-1; format=flowed |
| Content-Transfer-Encoding | 8bit |
| Subject | Re: loading dll within a jar |
| User-Agent | Unison/2.1.5 |
| Lines | 35 |
| X-Complaints-To | abuse@UsenetServer.com |
| NNTP-Posting-Date | Tue, 04 Oct 2011 03:53:25 UTC |
| Date | Mon, 3 Oct 2011 23:53:25 -0400 |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:8507 |
Show key headers only | View raw
On 2011-10-03 20:47:22 +0000, Philipp Kraus said:
> Hello,
>
> is there a way to load a DLL library that is stored within a Jar?
> At the time I'm using the -Djava.library.path flag but I would like
> to store the DLL within the Jar and added the path dynamically.
>
> I've found some information about this eg extract the DLL to the
> temp directory and set the -D option on the main-method.
>
> Can I set also the library path to the java command like the classpath
> argument? My java classes use the a
> static { System.loadLibrary("dllname"); }
> to load the library, so can I add on the static attribute a call for loading
> the dll within the jar?
>
> Thanks
>
> Phil
DLL files (and their Unix counterparts) are loaded by the OS's binary
image loader, which near-universally expects a program or library to
come from a file on the filesystem. A loader that's clever enough to
look inside a ZIP file is a rare beast indeed.
Short answer, no, you can't get there from here. Unpack your .DLL
somewhere (java.io.tmpdir, for example) and load it from there. The
Java Web Start protocol includes support for native libraries
distributed inside JAR files, if you don't want to write the
unpack-and-load glue yourself and if your app is appropriate for web
start.
-o
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
loading dll within a jar Philipp Kraus <philipp.kraus@flashpixx.de> - 2011-10-03 22:47 +0200
Re: loading dll within a jar Owen Jacobson <angrybaldguy@gmail.com> - 2011-10-03 23:53 -0400
Re: loading dll within a jar Philipp Kraus <philipp.kraus@flashpixx.de> - 2011-10-04 11:19 +0200
Re: loading dll within a jar Roedy Green <see_website@mindprod.com.invalid> - 2011-10-04 02:33 -0700
Re: loading dll within a jar Philipp Kraus <philipp.kraus@flashpixx.de> - 2011-10-04 14:19 +0200
Re: loading dll within a jar Roedy Green <see_website@mindprod.com.invalid> - 2011-10-03 22:28 -0700
Re: loading dll within a jar Roedy Green <see_website@mindprod.com.invalid> - 2011-10-15 14:20 -0700
Re: loading dll within a jar Arne Vajhøj <arne@vajhoej.dk> - 2011-10-16 22:38 -0400
csiph-web