tôi đang sử dụng java se7 trên mac, bản xem trước oracle.tại sao tệp Files.probeContentType trả lại giá trị rỗng
Vấn đề của tôi là "Files.probeContentType" trả về giá trị rỗng ... có thể là do trạng thái ban đầu của se7 cho mac? Mã của tôi:
if(directory == null) return;
String content = null;
try {
content = Files.probeContentType(directory.toPath());
} catch (IOException e) {
JOptionPane.showMessageDialog(main, e.toString());
return;
}
if(content == null)
{
return;
}
else if(content.contains("image"))
{
main.pctviewer.setImage(directory);
}
tên của tập tin là:
"/ Users/admin/Desktop/temp/q12/formulare/Bildschirmfoto 2012/09/11 um 17.57.59.png"
và trong chế độ gỡ lỗi trong nhật thực nếu tôi lơ lửng trên file "đường dẫn file = Unis-path (id: 145)" là đỏ
một [phương pháp thay thế có thể tìm thấy tại đây] (http://stackoverflow.com/a/19712111/26510) –