On Apr 16, 2008, at 10:16 AM, Dale...@coats.com wrote:
First of all, fantastic job! I went to MSDN, picked up a few
details on a
Kernel32 interface, and had some native stuff running in
minutes...great
tool! I wish it was around years ago when I burned countless hours
on JNI.
My question is about a Windows-only deployment and how I can get the
size
down (it was troubling to triple the size of my program to get the one
call*).
The first thing I tried, which was quick and easy, was to unpack
jna.jar,
delete directories "darwin", "freebsd*", "linux*", and "sunos*", and
pack
it back up again. My test seemed to continue to work with this
modified
jar.
I just wondered if this was the "right" way to proceed, if I'm
looking for
trouble doing this, and if I can get even smaller using this
technique.
Realistically, I'm not going to have time to do a custom build, but to
deploy a smaller package on Windows, I think I'm on the right track?
Your approach is perfectly reasonable, a given platform never
references the natives for other platforms.
There are probably some other classes you could strip out
(CallbackReference*, Callback*Context), but I don't know how much size
you'd save doing that versus the work to find unused classes. You
could always turn on debug class loading and strip out any classes not
loaded when running what you *do* use.
You could also strip out the DLL version information from
jnidispatch.dll; resources seem to take up more space than the actual
information they contain (although I find it useful tagging
information easy to examine in Windows Explorer).
--Dale--
* The one call is to keep Windows from sleeping on me:
SetThreaExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED)