Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Application Path to create a new File

Tags:

java

path

eclipse

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.

like image 520
Gapchoos Avatar asked Dec 26 '22 17:12

Gapchoos


1 Answers

USE

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

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

Hope it helps :-)

like image 171
Mukul Goel Avatar answered Dec 31 '22 17:12

Mukul Goel