• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to get path where application is installed?  RSS feed

 
myron schabe
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
What I need to do is write a file to a relative directory to where my Java application is going to be installed. Where it will be installed can vary of course. So when I create my file like new File(parentName, child); I know my child path and name but not how to get the parent. Also, this is cross platform - so I need canonical.
Many Thanks
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The path your Java application is running from is given by:
System.getProperty("user.dir")
Is that what you're looking for?
 
myron schabe
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, that is exactly what I was looking for.
Many Thanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!