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



Bill Janssen wrote:

> If only
>I knew the name of the Mac app in my Java code...  Suppose I could
>hard-code it.

Use a property in Info.plist.  It's easy to do, and it will automagically
change regardless of where the app is, or even if the user renames it to
Kerflubble.

Let's say you have this Java code:
  String selfPath = System.getProperty( "self.name" );
  System.out.println( "I am at: " + selfPath );

Then you put this in the Properties dictionary under Java in Info.plist:
  self.name : String : $APP_PACKAGE

When you double-click the application, the Java launcher will automatically
substitute its actual base name for the $APP_PACKAGE string, and your code
that retrieves the property will see the resolved pathname.

See also:

<http://developer.apple.com/documentation/Java/Reference/Java14JavaDict/Variables/chapter_2_section_1.html>

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