wood burning stoves
The moose likes Swing / AWT / SWT and the fly likes Canonical Path without an extension Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Canonical Path without an extension" Watch "Canonical Path without an extension" New topic

Canonical Path without an extension

Jacky Luk
Ranch Hand

Joined: Aug 02, 2012
Posts: 634

When I do this, the returned file name has no extension attached.
Any ideas how to fix it?
Ranganathan Kaliyur Mannar

Joined: Oct 16, 2003
Posts: 1101

You have to post a SSCCE. For example, the posted code doesn't have ExtensionFileFilter or chartCanvas.

Basically, we should be able to copy the posted code, compile straightaway and then we would be in a position to run and reproduce the problem in our machines. That would end in a quick resolution.

Darryl Burke

Joined: May 03, 2008
Posts: 5048

Jack Luk wrote:When I do this, the returned file name has no extension attached.
Any ideas how to fix it?

String concatenation?

Also, the JDK comes with a perfectly usable FileNameExtensionFilter. Have you been reinventing the wheel?

luck, db
There are no new questions, but there may be new answers.
Kemal Sokolovic

Joined: Jun 19, 2010
Posts: 825

Why are you handling selected file as it is of type String ?

If you have JFileChooser#getSelectedFile() method that returns File, you can find out whatever you need to know about the file selected - including it's path, name with extension, etc.

The quieter you are, the more you are able to hear.
I agree. Here's the link: http://aspose.com/file-tools
subject: Canonical Path without an extension
It's not a secret anymore!