我在小程序中有以下代码,基本上将一些数据写入作为参数传递给 writeFile 方法()的文件
public class appletToWrite extends Applet{
public int writeFile(String asPath, String asData, int aiOverwrite)
{
int j = JOptionPane.showConfirmDialog(null,asPath+ "testing gng on", "data mil gaya!!!", 0);
try {
File localFile = new File(asPath);
if (localFile.exists()) {
if(aiOverwrite==1){
localFile.delete();
j =JOptionPane.showConfirmDialog(null,"overwrite = 1", "data mil gaya!!!", 0);
}
else{
j = JOptionPane.showConfirmDialog(null, "overwrite = 0", "data mil gaya!!!", 0);
return 0;
}
}
j = JOptionPane.showConfirmDialog(null, "niche aa gaye", "data mil gaya!!!", 0);
localFile.createNewFile();
BufferedWriter localBufferedWriter = new BufferedWriter(new FileWriter(localFile, true));
String str1;
localBufferedWriter.write(asData);
localBufferedWriter.close();
return 1;
}
catch (Exception localException) {
j = JOptionPane.showConfirmDialog(null, "catch mein aa gaya "+localException.getMessage(), "data nahi gaya!!!", 0);
localException.printStackTrace();
return 0;
}
}
}
我已经使用以下命令对 jar 进行了自签名
javac appletToWrite.java
jar cvf AppletClass.jar *.class
keytool -genkey -validity 3650 -keystore pKeyStore -alias formBuilder
keytool -selfcert -keystore pKeyStore -alias formBuilder -validity 3650
jarsigner -keystore pKeyStore AppletClass.jar formBuilder
但它仍然没有获得在本地机器上写入文件的所有权限,但文件权限被拒绝知道为什么?