File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes I/O and Streams and the fly likes How to find the extention of file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "How to find the extention of file" Watch "How to find the extention of file" New topic
Author

How to find the extention of file

Shyam Purkayastha
Ranch Hand

Joined: Jan 15, 2001
Posts: 57
Hi all
Whenever we use a JFileChooser to get a file it returns a File object.My question is weather it is possible to get the file extension string from the File object.If yes then how?
Mag Hoehme
Ranch Hand

Joined: Apr 07, 2002
Posts: 194
Hi Shyam,
the extension is the substring beginning with the last dot. For example:

Hope this helps.


Mag
li dalong
Greenhorn

Joined: Nov 14, 2002
Posts: 2
I want to think return .exe?what do me??
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to find the extention of file
 
Similar Threads
how to get the web link of uploaded file on web server?
file path?
java io
getting a file name
non-networked and network mode