IntelliJ Java IDE
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes How to programatically change value of codeBase in .java.policy file? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Developer Certification (SCJD/OCMJD)
Reply Bookmark "How to programatically change value of codeBase in .java.policy file?" Watch "How to programatically change value of codeBase in .java.policy file?" New topic
Author

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

TNguyen
Greenhorn

Joined: Apr 02, 2001
Posts: 6
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

Joined: Jul 28, 2000
Posts: 1825
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
 
IntelliJ Java IDE
 
subject: How to programatically change value of codeBase in .java.policy file?
 
Threads others viewed
Testing my past assignment game
000-341 sample test questions
createRobot
Passed 700,701 and 340 last Thursday
JAAS and Policy files problems
IntelliJ Java IDE