I have a maven web project in eclipse. I need to get the project's path, actually have to get list of files under src\main\resources\someFolder
in project.
Tried String dataDir = "src\\main\\resources\\someFolder";
, on running this directory structure is created inside eclipse folder like F:\softwares\eclipse\eclipse\src\main\resources\someFolder
. Same when using /
instead of \\
.
Tried System.getProperty("user.dir")
and new File(".").getAbsolutePath()
, they return F:\softwares\eclipse\eclipse
.
I need to access the project folder in my workspace F:\workspace\Project\src\main\resources\someFolder
But when created a core java app and used System.getProperty("user.dir")
and new File(".").getAbsolutePath()
, I am getting project path in workspace, F:\workspace\Project
. This src\\main\\resources\\someFolder
also works fine then.
Why this odd behavior from eclipse?