Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: JNI crashing during initialization



Matt Drance <email@hidden> writes:

> Hi Benjamin,
>
> simpleJavaLauncher does that in case your Java code needs to initialize the
> AWT (and therefore Cocoa).   If your Java code later initializes AWT (which
> will initialize an NSApplication), it will pick up the existing runloop on the
> main thread.  Starting a runloop is not integral to the process working
> correctly if your Java code is headless.  If this is a headless app that will
> not initialize the AWT, do what you will in your native main().  However, if
> you will use AWT at any point, you will want to "park in the runloop" as
> simpleJavaLauncher says.  If you are stuck in a loop of your own (doing some
> kind of I/O polling for example) when Java tries to load a Frame, you will
> block Cocoa (and therefore AWT) from initializing and not get very far.

Thank you for the explanation.  For some applications, I use a startup
property of -Djava.awt.headless=true (because I sometimes am forced to
use java.awt.BufferedImage objects etc. for image processing (JAI),
but no valid X11 DISPLAY is set) but I never actually use any GUI
objects; thus I am headless.  For other applications, I never even use
any awt objects at all.  So it sounds like I should be OK avoiding
parking in the runloop.
-- 
Benjamin
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden

References: 
 >Re: JNI crashing during initialization (From: Doug Zwick <email@hidden>)
 >Re: JNI crashing during initialization (From: Benjamin Rutt <email@hidden>)
 >Re: JNI crashing during initialization (From: Doug Zwick <email@hidden>)
 >Re: JNI crashing during initialization (From: Benjamin Rutt <email@hidden>)
 >Re: JNI crashing during initialization (From: Matt Drance <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.