Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Wanted: Help Creating policy file

 
Ranch Hand
Posts: 420
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Siegfried Heintze
Ranch Hand
Posts: 420
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Your mother was a hamster and your father was a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic