繁体   English   中英

我的JApplet无法写入我的APPDATA文件夹

[英]My JApplet can't write to my APPDATA folder

是的,我正在以小程序的形式制作基于文本的RPG。 打开后,此小程序将写入您的APPDATA目录。 它可以在IDE中运行,但是当我在Firefox中尝试时,它会显示一条错误消息。 这里是链接。

File otherWorldDirectory = new File(System.getenv("APPDATA") + "\\.otherWorld");

if (!otherWorldDirectory.exists()) {
    //Adding the folder .otherWorld to the APPDATA
    otherWorldDirectory.mkdir();
    System.out.println("Directory '.otherWorld' created.");
} else {
    //The folder .otherWorld already exists.
    System.out.println("Directory '.otherWorld' is not created, it exists.");
}

这是小程序的重点。 除非它们是“受信任的”,否则它们无法访问用户的磁盘。 您必须对小程序签名才能访问用户的磁盘。

打开后,此小程序将写入您的APPDATA目录。

不要那样做 苹果电脑。 &* nix机器不会拥有它,&小程序可以访问多种x平台的持久性形式。

  • 沙盒
    1. 饼干
    2. 如本演示中所示,JNLP API PersistenceService
  • 值得信赖
    1. user.home作为存储信息的x-plat位置。
    2. Preferences
    3. 所有方式都对沙盒应用开放。
    4. ...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM