• Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting application realpath in java  RSS feed

 
Santhana Lakshmi.S
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i want to get the path of the file where i stored in my computer
i.e.,if stored my file in desktop the path will be C://Documents and Settings/Desktop/myfile.txt.

how can i get this file path in java?

Can anyone help me in this?

Thanks a lot
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have a java.io.File object that represents the file, then getAbsolutePath() returns the absolute path. If you don't, well, then you don't know where the file is, so obviously you can't get the path.

Do you mean you want to find a file?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!