View Full Version : Xcode Java Java.util.PropertyPermissions user.dir.read

Jul 11, 2007, 02:00 PM
Hey Guys and Gals,

Happens only under xcode, if i run from the terminal everything is fine.

I assume there is an option somewhere that i could set within xcode but can find any info anywhere.

Just attempting to open a JFileChooser when this exception is thrown.

Access Denied(Java.util.PropertyPermission) user.dir read


Jul 11, 2007, 03:34 PM
I really cant believe im the only person ever to use xcode and a JFileChooser.

I cant find any info on importing policy files, anything. Its a simple read, not even trying to write.

Arggg, really annoying.


Jul 11, 2007, 03:44 PM
I'd be happy to try it on my Mac if you zip a test project.

b e n

Jul 11, 2007, 03:45 PM
code might help

Jul 11, 2007, 03:51 PM
Custom app for profit, lol.

I can make a small app to demo,

Hold on,


Jul 11, 2007, 04:28 PM
Here we go,

Xcode project that duplicates the error, sorry i was in a rush.

I couldnt get the whole thing under the 244kb max so there are 4 small jave files, i guess just create a new xcode project and add them manually.

Sorry for the troubles. I tried combining them all in one file, but always like 3mb.


thanks again

Jul 11, 2007, 04:35 PM
FileChooser line 25: You shouldn't rely on environment variables, especially for path names.

Instead of $home, try using

Jul 11, 2007, 04:51 PM
Yeah i tried that earlier but no luck,

Any other suggestions?

Works perfect outside of xcode

Jul 11, 2007, 05:17 PM
Looks to me like you need to set the Java policy for the applet. Running it from the command line and running it as an applet are different things.

Hope this helps

b e n

Jul 11, 2007, 05:23 PM
I hear u, but the big question is how in the world to do this through xcode?

I tried just throwing a policy file in the directory but no luck.

Jul 11, 2007, 05:28 PM
Look at this link (http://developer.apple.com/documentation/Darwin/Reference/Manpages/man1/policytool.1.html)

I just tried it and I managaed to get you test app to work. Basically you need to create a .java.policy file in your home directory and assign your app the relevant permissions. If you're like me and lazy just assign it all permissions.

If you plan on distributing something then you'll need to sign your app. I don;t know how you do that though.

b e n

Jul 11, 2007, 05:32 PM
Your .java.policy file in your home directory would have an entry looking something like this:-

grant codeBase "file:///Users/ben/path-to-project/build/Debug/project-name.jar" {
permission java.security.AllPermission;

b e n

Jul 12, 2007, 10:07 AM
Hey Lazy Dog thanks for the help,

I tried including the policy file in the directory for the app, nothing worked.

Thanks for the suggestion to put in the home directory works perfect now,

So why is it that i dont need to do this on any of my linux build, windows and such?

thanks again,


Jul 12, 2007, 11:21 AM
I'm not sure… are you sure you can run your app from a browser on Linux and Windows? I'm not even remotely an expert on this sort thing but I suspect it has something to do with the default policies, ie OS X is more cautious than Linux or Windows?

b e n