I just tried a sample:
import javax.swing.*;
import javax.swing.filechooser.FileNameExtensionFilter;
import java.awt.*;
public class Trial {
public static void main(String... args) {
JFrame frame = new JFrame("FrameDemo");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JLabel emptyLabel = new JLabel();
frame.getContentPane().add(emptyLabel, BorderLayout.CENTER);
frame.pack();
frame.setVisible(true);
JFileChooser chooser = new JFileChooser();
FileNameExtensionFilter filter = new FileNameExtensionFilter("JPG & GIF Images", "jpg", "gif");
chooser.setFileFilter(filter);
int returnVal = chooser.showOpenDialog(frame);
if(returnVal == JFileChooser.APPROVE_OPTION) {
System.out.println("You chose to open this file: " +
chooser.getSelectedFile().getName());
}
}
}
on a OS X 10.9.1
running JDK 1.7.0_51
. I created the following folders hierarchy: ~/Documents/Joyeux Naufragés/ábc Eóz
: .
In order to address the problem you described I installed also the JDK you pointed out, JDK_1.7.0_25 and I managed to reproduce the same issue, here is the snapshot for the same window running u25
As one can see the folders containing special characters don't show. So I checked also with
JDK 1.7.0_40 and surprise - it works. After that I went over the bugs fixed in the given version, I found out that several bugs related mac os x where fixed in this release. Among which a couple (7024118, 7032018, 7032436, 7161437) refer to issues in JFileChooser. There are other issues related to mac (45 in total) out of which one refers to FileDialog. Unfortunately the links to the bug descriptions don't work, so I cannot post more info on the subject, but the solution for your issue is definitely to update to at least version 1.7.0_40 even if I suppose the best would be to update to the latest (1.7.0_51).
Good luck with your work. I hope this helps you.
-Dfile.encoding=UTF-8
as mentioned in the above referenced posts? – Caritta