Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Java.security.AccessControlException: access denied...

Status
Not open for further replies.

petersJazz

Programmer
Jan 28, 2002
222
EU
I have a web site with Apache, Tomcat, Jsp, Java and mySQL. In the java code Im trying to create a file and I get the message:

java.security.AccessControlException: access denied (java.io.FilePermission <<filename>> write)

Any hint, how can I configure this?
 
Its a permission problem, so you must add a file permission to the code your are running.

Go to your policy file on window it is usually located under the homedirectory of JAVA.

C:\jdk1.3.0_01\jre\lib\security

add the following in the top of the file. Save the file and try again.

permission java.security.AllPermission;
//location of your code library...
grant codeBase &quot;file:/C:/Projects/FileIO/*&quot; {

permission java.io.FilePermission &quot;C:${/}AppDevStudio${/}webAF${/}Projects${/}FileIO${/}File${/}-&quot;, &quot;write&quot;;

};

read more about java security at under tutorials..

Jim
 
Its a permission problem, so you must add a file permission to the code your are running.

Go to your policy file on window it is usually located under the homedirectory of JAVA.

C:\jdk1.3.0_01\jre\lib\security

add the following in the top of the file. Save the file and try again.

grant codeBase &quot;file:/C:/Projects/FileIO/*&quot; {
permission java.io.FilePermission &quot;C:${/}AppDevStudio${/}webAF${/}Projects${/}FileIO${/}File${/}-&quot;, &quot;write&quot;;

};

you cal also add instead, but not reccomended. this grants the code every permissions on your computer

grant codeBase &quot;file:/C:/Projects/FileIO/*&quot; {
permission java.security.AllPermission;
};



read more about java security at under tutorials..

Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top