Problème avec ShellFolder
Bonjour je teste le programme suivant mais il ne fonctionne pas à cause du message
"Access restriction: The type ShellFolder is not accessible due to restriction on required library C:\Program Files\Java\jdk1.6.0_24\jre\lib\rt.jar"
Voici le code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
import java.io.*;
import javax.swing.*;
public class IconExtract1 {
public static void main(String[] args) throws Exception {
String s = "c:/windows/regedit.exe";
File file = new File(s);
// Get metadata and create an icon
sun.awt.shell.ShellFolder sf =
sun.awt.shell.ShellFolder.getShellFolder(file);
Icon icon = new ImageIcon(sf.getIcon(true));
System.out.println("type = " + sf.getFolderType());
// show the icon
JLabel ficon = new JLabel(s, icon, SwingConstants.LEFT);
JFrame frame = new JFrame();
frame.getContentPane().add(ficon);
frame.pack();
frame.setVisible(true);
}
} |
Une idée , Merci