[ImageJ-devel] imagej-loader / dlopen args
johannes.schindelin at gmx.de
Wed Mar 18 14:32:23 CDT 2015
On 2015-03-18 14:47, Lee Kamentsky wrote:
> I'm programming "monkey see, monkey do" style. I have very little idea
> I'm doing, trying to replicate the logic for mac loading dylibs in
> I've gotten pretty far, but at the end, I'm seeing the error,
> "JavaNativeFoundation: GetGlobalVM: JNI_GetCreatedJavaVMs() failed to
> any VM" when I start an AWT app.
Do you expect a JVM to be running already? If not, you should [create
> I am guessing that this is why you dlopened libjli here
Heh, I have to admit that I did not remember at all why I did that.
Happily, even I learned to write kick-ass commit messages, and I also
learned the awesomeness of the `Blame` button on GitHub:
(I vaguely remember writing that commit message after spending something
between twenty and thirty super-focused hours on hunting down this bug,
that was not really fun, that one hunt).
> I do the same, but (so far) with Python's ctypes.CDLL. That doesn't let
> specify RTLD_LAZY as a dlopen mode. So, I think that's the big
> between how you do things and how I do them. My first question is
> RTLD_LAZY is needed as the mode. My second question is why you needed
> load libjli.dylib in the first place and, if you might grant me a third
> wish, my third question is whether you've seen this error before.
The JLI library is only needed for forward compatibility, so that MacOSX
does not annoy the user by a "Do you want to install Java 6?" popup.
And yes, I have seen an error like that before, but only when trying to
attach to a running JVM from within Matlab (Matlab's very own GUI is
written in Java... so there is already a JVM running in a Matlab
instance although it is a bit tricky to get at it under certain
circumstances, but it is impossible to run two Oracle JVMs in the same
process in any case).
> Thanks in advance, Mr. Wizard.
Sorry, oh ye mighty Python God, I fear my input was not really helpful
to your cause. But maybe you have a project for me to clone, with
instructions that might let this poor Python pilgrim reproduce the
More information about the ImageJ-devel