SecurityException: Unable to create temporary file with applet

My applet tries to write a temp file

try{

File temp = java.io.File.createTempFile("student",".log");

strFilename = temp.getAbsolutePath();

}

}catch (IOException e1){

e1.printStackTrace();

}

But when I run, it throws an exception:

java.lang.SecurityException: Unable to create temporary file

I tried to sign the applet, as to http://www.developer.com/java/data/article.php/3303561 but it's still the same.

There's another way: using java.policy,

grant{

permission java.security.AllPermission;

};

but it seems to be not very gentle. Could you show me the solution please? Thanks in advance.

Cheers,

[1013 byte] By [Lehoanqa] at [2007-11-27 1:56:27]
# 1
Check posting #2 at: http://forum.java.sun.com/thread.jspa?forumID=63&threadID=524815
attilaracza at 2007-7-12 1:30:50 > top of Java-index,Desktop,Core GUI APIs...
# 2

Yes, that's what I found. Here is the summary to do it, hope it helps someone else:

1. Create key for signed jar:

keytool -genkey -keystore abc.com -keyalg rsa -dname "CN=Abc, OU=Def, O=GHI, L=KLMN, ST=OP, C=XY" -alias TheCert -validity 3600 -keypass password -storepass password

2. Make jar file

3. Sign the jar file

jarsigner -keystore abc.com -storepass password -keypass password -signedjar SignedAppletTest.jar OrgAppletTest.jar TheCert

It works for me.

I'd like to thank harmmeijer and everyone who interests.

Cheers,

Lehoanqa at 2007-7-12 1:30:50 > top of Java-index,Desktop,Core GUI APIs...