*
The moose likes Mac OS and the fly likes Preferences on the Mac Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Mac OS
Bookmark "Preferences on the Mac" Watch "Preferences on the Mac" New topic
Author

Preferences on the Mac

Mike Lipay
Ranch Hand

Joined: Sep 11, 2007
Posts: 171
I tried creating a preferences file using the code below, it works on Windows but not on Mac. Is there something else I need to do, or a different way to accomplish this?

Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

If the user executing the code doesn't have permission to write on the path used (the whole path) - then it is not possible.

OS X is based on Unix (or is Unix), therefore the right owner/group permissions are needed.


Regards, Rene Larsen
Dropbox Invite
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41603
    
  55
I don't think there should be a permissions problem - a user should be able to access anything in her own userRoot, no?

Or do you mean the actual file "/Users/xyz/Library/Preferences/com.lipay.swreg.plist"? That would be screwed-up file permissions, though.


Ping & DNS - my free Android networking tools app
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

Ulf Dittmer wrote:I don't think there should be a permissions problem - a user should be able to access anything in her own userRoot, no?

Or do you mean the actual file "/Users/xyz/Library/Preferences/com.lipay.swreg.plist"? That would be screwed-up file permissions, though.


I think it could be necessary to do a "Repair Disk Permissions" with "Disk Utility"??

I have just tested the code posted, and it works on my Mac.
Mike Lipay
Ranch Hand

Joined: Sep 11, 2007
Posts: 171
Thanks everyone, I found the problem.

Working between the two platforms I missed changing a \ to a / when I moved it to the Mac. After doing a couple different searches on this forum I finally hit one that covered System.getProperty("file.separator"), our class hasn't covered system properties yet, so I replaced \ everywhere with the file separator constant.
 
Consider Paul's rocket mass heater.
 
subject: Preferences on the Mac