Get Application Path to create a new File

How can I get the Application path of a Project in a String variable LogPath. The LogPath is used later on to create a Log File of the Project. Am using Eclipse for coding.

Answer

USE

String AbsolutePath = new File(".").getAbsolutePath();

Explanation : File(".") represents the current directory and getAbsoultePath() returns absolute path to the current directory.

Hope it helps 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *