Rob Y wrote:
> 
> I'm using POI via JNI from a C application, and it's working well for me
> when I invoke it once.
> 
> Problem is that DestroyJavaVM doesn't seem to work (returns -1), so the
> next time I try to use POI, I get an error on JNI_CreateJavaVM (also
> returns -1).  I'm running on AIX5L with java5 installed.  My app is part
> of a transaction processing system, and wants to stay resident to be
> reused as appropriate.  It's use of POI is only occasional, so I don't
> want to keep the JVM around after using it.
> 
> I can set my app to exit (and later be respawned as needed) after using
> POI, and that would solve the problem.  In fact, for debugging purposes,
> it behaves this way all the time on my development machine - that's how I
> got POI working without encountering this problem.
> 
> Anyway, this is more of a basic Java question than a POI question, but
> somebody here gave me the code I used to get started with JNI, so I was
> hoping to have some luck solving this problem too.
> 
> Thanks,
> Rob
> 

For what it's worth, I tried commenting out my DestroyJavaVM call and
bypassing JNI_CreateJavaVM if it's already been done.  This lets me run my
POI JNI stuff multiple times (and speeds it up too).  The only problem
(besides the extra memory footprint for keeping the JVM around) is that my
POI stuff is part of a generic printing library (print to PDF or XLS) that's
used by a wide set of applications.  None of those apps use Java today, but
if they wanted to use java in the future, and I hogged the JVM, that'd be a
problem (I assume you can't launch multiple JVM's within the same process).

I've found various postings saying the DestroyJavaVM has never worked, but I
don't always trust info from a Google search to be current.  So, what's the
deal?  Is there no way to shutdown a JVM once you've launched it short of
exiting your app completely?

Rob

-- 
View this message in context: 
http://www.nabble.com/Using-POI-via-JNI-tp20774758p20775023.html
Sent from the POI - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to