Saturday, October 13, 2012

How specify platform independent paths in java.security and policy ...

I want to ship a single security policy file to our customers - for both Linux and Windows. In the java.security file, I add a line to point to our file, but due to path differences I have to specify it differently for Windows and Linux

policy.url.3=file:/${our.home}/lib/OurSecurity.policy  # Windows policy.url.3=file:${our.home}/lib/OurSecurity.policy   # Linux 

That first "/" after the "file:" is needed on windows since the variable our.home is defined as "C:\foo". I have the same problem in the policy file itself:

grant codeBase "file:/${our.home}/-"   // Windows grant codeBase "file:${our.home}/-"    // Linux 

I'm especially looking for a clever way to specify the codeBase in a platform independent way. By the way, redefining our.home is not really an option, as it's needed in a FilePermission clause.

Source: http://stackoverflow.com/questions/12865429/how-specify-platform-independent-paths-in-java-security-and-policy-files

London 2012 basketball London 2012 Slalom Canoe Alex Morgan Misty May Treanor Lolo Jones Aly Raisman Marvin Hamlisch

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.