0

所以,是的,我正在以小程序的形式制作基于文本的 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.");
}
4

2 回答 2

2

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

于 2011-08-24T17:33:08.497 回答
1

此小程序在打开时会写入您的 APPDATA 目录。

不要那样做。苹果电脑。& *nix 机器将没有它,& applet 可以访问多种形式的持久性,即 x-plat。

  • 沙盒
    1. 饼干
    2. 本演示PersistenceService中看到的 JNLP API 。.
  • 值得信赖
    1. user.home作为存储信息的 x-plat 位置。
    2. Preferences
    3. 对沙盒应用程序开放的所有方式。
    4. ...
于 2011-08-24T17:48:31.227 回答