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

Source: Internet
Author: User

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

New FileOutputStream ("MyFile")

Then it's 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 was not updated. It can be seen as the initial current directory of the application.

If you start your Java app with a batch file, and DoubleClick on the "link to it," the current directory would be the directory Where the batch file resided, but this can is changed in the link.

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

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

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.