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: Making an application "active" from java



Michael K?lling <email@hidden>

>When using the 'open' command, the story is different. Then you need
>the application name. But then again, that requires there to be an
>application in the file system. For me this is a problem, because I'd
>like to get a process to the front that I spawned myself -- it has no
>application in the file system to 'open'.

That's quite a problem.

Can you describe the child process and how you spawn it?  For example, is
it a Java program, does it have a GUI, etc.?  Does it have to work across
multiple platforms or is it Mac OS X only?

Also, how much can you change this child program?

I ask because you might be able to send a Posix signal to the child, and
its response could be to bring itself to front.  Sending signals is easy
enough, just exec() the 'kill' command.  Receiving signals is harder, but
two options are my open source Suite/P Toolkit, or the older 1.3-only Easy
Posix Toolkit:
  <http://www.amug.org/~glguerin/sw/#suitep>
  <http://www.amug.org/~glguerin/sw/#easyposix>

Suite/P works on 1.4 or 1.3, and is much easier to customize or strip down.


If signals won't work, you could write a C or ObjC program that acts as
mediary.  It would take an arg that's an appropriate process identifier,
and then send that process an AppleEvent that activates the target process
(brings it to front).  Then your parent Java app just uses exec() to run
the mediary each time.  Or the mediary can stay alive, and act as a signal
mediary: catch signal, send AppleEvent.

The advantage to using a mediary process is encapsulation.  You can write
it any way you want, using a language of choice, and since it's a separate
process you don't have to adhere to JNI, JVM threading, or any other
Java-based constraint.

When a problem is simple and focused like this, creating a mediary process
may be a better approach than writing JNI code.

  -- 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.