Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to programatically change value of codeBase in .java.policy file?

 
TNguyen
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone,
Could someone please let me know how to programatically modify
the value of codeBase in the .java.policy file?
Specifically, please let me know if you are using a script at
installation time to modify the value for codeBase in the
.java.policy file or if/how you are doing this from your java
code on the database server (e.g. start up time, etc.).
To start up my RMI database server, I am using a .java.policy file with the following syntax generated from the policytool:
grant codeBase "file:/D:/SCJD_TimothyNguyen/*" {
permission ...;
permission ...;
};
At database server start-up time, I would like to
programatically check the value of an environment
variable called "SCJD_INSTALL_DIR" and then
replace the string:
"file:/D:/SCJD_TimothyNguyen/*"
in the .java.policy file with the following string:
"file:/<Value of SCJD_INSTALL_DIR environment variable>/*"
I have been thinking about writing a Windows install.bat
installation script (and the equivalaent UNIX install.sh
installation script) to:
1) Set the value for the SCJD_INSTALL_DIR environment variable
according to user input when the installation script is executed.
2) Read in this value and modify the value of the string
"file:/D:/SCJD_TimothyNguyen/*" in the .java.policy file.
Please let me know if this is a correct approach.
Lastly, please let me know how/if you are using the following
command-line arguments on your database server:
java.rmi.server.codebase
security manager policy file
Thank you for your help.
Timothy Nguyen
 
Rahul Mahindrakar
Ranch Hand
Posts: 1869
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
TNguyen,
Welcome to Javaranch. We follow some rules pertaining to User names. The rules are specified at here
Your User name does not follow these conventions. It is recommended that you immediately register under a name conforming to the conventions.

------------------
Regds.
Mahindrakar
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic