我有一个我编写的 Java 桌面应用程序。在执行期间,我以系统中定义的默认路径名创建文件夹和文件。
Java.io.files 明确指出:By default the classes in the java.io package always resolve relative pathnames against the current user directory. This directory is named by the system property user.dir, and is typically the directory in which the Java virtual machine was invoked.
此外,我正在使用 IzPack 来启用安装和快捷方式创建。
当我在我的 XP 计算机上运行我的应用程序时,安装后我得到一个桌面快捷方式,并且提到的文件和文件夹创建位于 Izpack 安装 Jar 的位置。这是预期的行为。
但是当我在 Vista 机器上测试时,文件夹和文件是在桌面上创建的!即使 Jar 位于正确的位置(c:\program files.. 等)。
我希望在 Jar 所在的同一文件夹中创建这些文件,而且肯定不在桌面上。
谁能给我关于这里发生的事情的任何见解?