| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
|
The AppleEvent accepting stuff needs to be set correctly as well I think.
You should should have a unique creator, correctly set plist and at least last I
checked for some reason still need a correctly set PkgInfo file as well, in
appedit java terms...
String type = new
String(buffer,0,4);
String plisttype = (String)plist.get("CFBundlePackageType"); String creator = new String(buffer,4,4); String plistcreator = (String)plist.get("CFBundleSignature"); if (!type.equals(plisttype) && !creator.equals(plistcreator)) System.out.println("PkgInfo out of sync with plist - PkgInfo[" + type + "," + creator + "] , Info.plist[" + plisttype + "," + plistcreator + "]"); else if (!type.equals(plisttype)) System.out.println("PkgInfo out of sync with plist - PkgInfo type is " + type + " Info.plist CFBundlePackageType is " + plisttype); else if (!creator.equals(plistcreator)) System.out.println("PkgInfo out of sync with plist - PkgInfo signature is " + creator + " Info.plist CFBundleSignature " + plistcreator); else System.out.println("PkgInfo present [" + type + "," + creator + "] - OK"); With a uniquely named executable, unique creator, PkgInfo right, and all
plist properties set correctly, you should see your process running under it's
unique non-JavaApplicationStub name. Incidentally you can of course check that
from java using JNIDirect.
import macnative.jnidirect.struct.ProcessSerialNumberStruct;
import macnative.jnidirect.struct.ProcessInfoRecStruct; import macnative.jnidirect.files.FSSpec; import macnative.jnidirect.string.Str31; import macnative.jnidirect.functions.ProcessFunctions; import jnidirect.macnative.OSType; import utillib.logging.Logger; import utillib.logging.LoggerInterface; public class mps { public static final LoggerInterface logger = Logger.getInstance("roor.org.cmd"); private static final short noErr = 0; private static final short procNotFound = (short)-600; public static void main(String [] args) { ProcessSerialNumberStruct psn = new ProcessSerialNumberStruct(); ProcessInfoRecStruct info = new ProcessInfoRecStruct(); info.setProcessInfoLength(ProcessInfoRecStruct.sizeOfProcessInfoRec); Str31 name = new Str31(); FSSpec appspec = new FSSpec(); info.setProcessName(name.getPointer()); info.setProcessAppSpec(appspec.getPointer()); short err = noErr; for (;;) { err = ProcessFunctions.GetNextProcess(psn.getPointer()); if (err == procNotFound) break; if (err != 0) logger.error("mps: error getting process. err: " + err); else { err = ProcessFunctions.GetProcessInformation(psn.getPointer(),info.getPointer()); if (err == noErr) { String signature = new OSType(info.getProcessSignature()).toString(); String procname = name.toString(); String path = appspec.fullPath(); int[] pid = new int[1]; int status = ProcessFunctions.GetProcessPID(psn.getPointer(),pid); System.out.println("Name: " + procname + " Signature: " + signature + " pid(" + pid[0] + ") path " + path); } else logger.error("mps: error getting process info. err - " + err + ". continuing..."); } } } } which I'll leave as an exercise for those interested to convert to normal
JNI if they wish. Although why not just use or add to all the neat JNIDirect I
have for this? I don't know. Anyhow some blasts from the past on my stuff. Good
times.
Mike Hall mikehall at
spacestar dot net
|
_______________________________________________ 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
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
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.