Changing the current working directory in Java?

前端 未结 14 1509
太阳男子
太阳男子 2020-11-22 05:32

How can I change the current working directory from within a Java program? Everything I\'ve been able to find about the issue claims that you simply can\'t do it, but I can\

14条回答
  •  再見小時候
    2020-11-22 05:45

    The other possible answer to this question may depend on the reason you are opening the file. Is this a property file or a file that has some configuration related to your application?

    If this is the case you may consider trying to load the file through the classpath loader, this way you can load any file Java has access to.

提交回复
热议问题