GeeCON Prague 2014*
The moose likes Applets and the fly likes Wanted: Help Creating policy file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Applets
Bookmark "Wanted: Help Creating policy file" Watch "Wanted: Help Creating policy file" New topic
Author

Wanted: Help Creating policy file

Siegfried Heintze
Ranch Hand

Joined: Aug 11, 2000
Posts: 381
I'm trying to follow this tutorial and I'm confused about the file name of the policy file.

Below is the code that goes into the policy file (from the above URL). Now Where do I put it on a windows machine? %HOMEDRIVE%%HOMEPATH%? What do I specify as the keystore?

How do I edit it for a windows machine running cygwin?

If I type



it says "bad substitution" at the cygwin bash prompt.



Thanks,
Siegfried
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42035
    
  64
First off, "user.home" is an identifier that's understood by the JVM, not something the shell would know about. So I'm not surprised cygwin doesn't like it. The user's home directory is the one denoted as "~" in Unix; "echo ~" should tell you what it is.

You can name the file anything you want, since you need to pass the filename to the JVM process through the "java.security.policy" runtime parameter, as shown in the page you linked to.


Ping & DNS - my free Android networking tools app
Siegfried Heintze
Ranch Hand

Joined: Aug 11, 2000
Posts: 381
When I specify the keystore, is there a way I can avoid hard coding "/home/ray/keystore/" on line two? I'd like to do it in a way that OS neutral.

Perhaps the answer is to use "${user.home}/keystore" on line 2?

Let me ask the question in a broader way:

Why do I see a "$" on line 12 but not on line 10? In both cases, we are expanding a java property called user.home. Can someone point me to the documentation where it describes when and how properties are expanded in the properties file.
Thanks,
Siegfried
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42035
    
  64
Why do I see a "$" on line 12 but not on line 10? In both cases, we are expanding a java property called user.home.

Line 10 does not expand anything. "user.home" on that line is not a property - it is the name of a permission that is being granted. It just happens to be called the same as a certain system property (and is of course related to it).

If you read the javadocs for PropertyPermission and FilePermission the difference should become clear.
 
GeeCON Prague 2014
 
subject: Wanted: Help Creating policy file