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: Finding a path inside a bundle




On Jan 12, 2007, at 1:21 PM, Greg Guerin wrote:


For a real-world example,

I think you can fairly easily create a small application to demonstrate your options here. With a Info.plist including


	<dict>
		<key>ClassPath</key>
		<string>$JAVAROOT</string>
		<key>JVMVersion</key>
		<string>1.4+</string>
		<key>MainClass</key>
		<string>EchoAppPackage</string>
		<key>Properties</key>
		<dict>
			<key>apppkg</key>
			<string>$APP_PACKAGE</string>
			<key>javaroot</key>
			<string>$JAVAROOT</string>
		</dict>
	</dict>

and the java...

public class EchoAppPackage {

	public static void main(String[] args) {
		System.out.println("$APP_PACKAGE = " + System.getProperty("apppkg"));
		System.out.println("$JAVA_ROOT = " + System.getProperty("javaroot"));
		System.out.println("user.dir = " + System.getProperty("user.dir"));
	}
	
}

compiled and the class file place put into the $JAVAROOT classpath location.
The app run from my home directory gives...


$APP_PACKAGE = /Users/mjh/EchoApp.app
$JAVA_ROOT = /Users/mjh/EchoApp.app/Contents/Resources/Java
user.dir = /Users/mjh

I think the advantage to you of using the Info.plist properties over the normal java user.dir property is if the user decides for some twisted reason to rename your application. user.dir will not show that, the Info.plist properties will.

But I think that shows most of your options from a java application bundle.

Mike Hall        mikehall at spacestar dot net
http://www.spacestar.net/users/mikehall
http://sourceforge.net/projects/macnative



Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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: Finding a path inside a bundle (From: Greg Guerin <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.