Permission Not Being Granted

Hi,

I'm new in java security. I'm trying to grant "java.security.AllPermission" to my program but getting AccessControlException. Here is the program:

package t;

public class MyApp {

public static void main(String[] arg) throws Exception{

FileWriter writer = new FileWriter( new File("c:/a.txt") );

writer.write("HELLLO");

writer.flush();

writer.close();

}

}

Here is my policy file:

grant codeBase "file:/home:/t/*" {

permission java.security.AllPermission;

permission java.security.SecurityPermission "getPolicy";

};

here is the command line:

java -Djava.security.manager -Djava.security.policy=file:/c:/t/my.policy t.MyApp

Any solution.

thx

[801 byte] By [rezsama] at [2007-11-27 6:09:51]
# 1

A codebase is a list of one or more directories or JAR files that contain .class files in a directory structure corresponding to the package structure.

grant codeBase "file:/home:/t/*"

That's not a codebase specification. That's a specification for a FilePermission.

ejpa at 2007-7-12 17:14:26 > top of Java-index,Security,Other Security APIs, Tools, and Issues...
# 2
Thanks for your reply. My mistake it should be:grant codeBase "file:/C:/t/*"since the My app is located at C:/t/but still is not working.
rezsama at 2007-7-12 17:14:26 > top of Java-index,Security,Other Security APIs, Tools, and Issues...
# 3
That's still wrong. Read what I wrote again. That's not the name of a directory or a JAR file. The '*' syntax is only supported by FilePermission.
ejpa at 2007-7-12 17:14:26 > top of Java-index,Security,Other Security APIs, Tools, and Issues...