首页 > 编程语言 > 详细

In Java, what is the default location for newly created files?

时间:2014-10-17 01:20:14      阅读:202      评论:0      收藏:0      [点我收藏+]

If the current directory of the application. If e.g. you create a File by using

new FileOutputStream("myfile")

then it is created in the "current" directory, which can be retrieved by calling

System.getProperty("user.dir");

However if you change the current directory by calling native methods (very unlikely!), the property is not updated. It can be seen as the initial current directory of the application.

If you start your Java app in a batch file, and doubleclick on the link to it, the current directory will be the directory where the batch file resided, but this can be changed in the link.

If you start your Java app from the command line, you already know the directory you are in.

If you start your Java app from the IDE, the current directory is usually the project root, but this can usually be configured in the launch configuration.

In Java, what is the default location for newly created files?

原文:http://www.cnblogs.com/ghgyj/p/4030068.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!