Re: Preferences File & storing in .app
Re: Preferences File & storing in .app
- Subject: Re: Preferences File & storing in .app
- From: Logan Allred <email@hidden>
- Date: Tue, 4 May 2004 07:22:01 -0600
If you're using pure Java on a Mac with Java 1.4 or later, then the
built-in java.util.prefs.Preferences I believe uses the normal Mac OS X
Preference files and locations (I would guess it's implemented
internally on top of NSUserDefaults). On Java 1.3.1, it will be a bit
trickier, but System.getProperty("user.home") will get you to the
user's home directory, where you can probably get to
Library/Preferences after that (just be sure to sure to name your
preferences file according to Apple's preference file naming
conventions for compatibility). There is also probably the possibility
of using Runtime.exec(String[]) method on the defaults utility (see man
defaults), all properly wrapped in OS-specific code for cross-platform
compatibility.
Many Java applications just put a file in the user.home directory for
simplicity and portability, sometimes with a . at the front of the name
so it's not visible to the end user on most platforms. Not very
Mac-like though.
Good luck,
--Logan Allred
On May 3, 2004, at 1:13 PM, Larry Fransson wrote:
On May 3, 2004, at 08:02, Matthias Edrich wrote:
Hi All,
I want to store application preferences within a Preference File
within the standard user home location
in Mac OS X.
My application is programmed with XCode in Java.
If you're using Cocoa-Java, see the documentation for NSUserDefaults.
If you're using pure Java, you're on your own!
Larry Fransson
Seattle, WA
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.