码迷,mamicode.com
首页 > 编程语言 > 详细

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

时间:2014-10-17 02:45:43      阅读:157      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   io   ar   java   for   sp   div   

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?

标签:style   blog   color   io   ar   java   for   sp   div   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!