• Post Reply Bookmark Topic Watch Topic
  • New Topic

JFileChooser

 
Santosh Maskar
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Can anyone know how to get the Absolute path of the file
For Eg.
I have file d:\java\test\book.xml
Output is

d:\java\test\book.xml

I have used the getAbsoluteFile() and there are so many API but not gettting the correct result it just show ing the file name , but i want this with its path


Regards
 
Rachel Swailes
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use this

myFile.getCanonicalPath()

the method does throw exceptions. I can't remember which ones offhand, but it's in the API.

Cheers,
Rachel
 
Santosh Maskar
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rachel,

Thanks for the same it thorows the IOException


Regards
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!