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: Invoke JNI and also capture 'quit' events?



Jamison Hope wrote:

>I'm writing a program which needs to do the following things:
>
>1. Open a connection to a message-passing system which communicates via
>SysV IPC.
>2. Invoke a JVM and instantiate some GUI objects (i.e. the AWT not-on-
>mail-thread rule applies).
>3. Listen for messages on IPC, and convert them into appropriate Java
>method calls (and do them).
>4. Cleanly disconnect from the IPC system when the program quits.

I neglected to mention this before...

If your IPC communication uses Unix domain sockets, there are existing JNI
libraries that can provide that functionality, sometimes as a Socket class.
As outlined in my earlier suggestion, your Java code would then run as a
normal Java main() method, launched with the usual 'java' command or
JavaApplicationStub.  It would then call the functions in the JNI libs to
communicate.  This is fundamentally a Java application that happens to use
native libs, which is the opposite direction of your current approach: a
native application that happens to use a JVM.

When I was researching Unix domain sockets a while ago, I concluded the
Jtux library by Mark Rochkind was worth investigating further.  A different
project came up that took me off Unix domain sockets, or I would have
researched this more fully at that time.  Jtux certainly looked more
promising than anything else I found, but YMMV.

Jtux -- Java-to-Unix -- (~BSD License) - JDK 1.4.2
  <http://www.basepath.com/aup/jtux/>

It covers a LOT of Unix functionality, but IS NOT an object-oriented view
of the Unix/Posix API.  It has good reference material written about it,
and it has been tested on Mac OS X (10.4).  It also comes with a BSD-like
license, where the other libs I found were GPL or LGPL.

The Jtux web page also has links to other libs, which may be of interest.

  -- GG


 _______________________________________________
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



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.