Java - Problème JFileChooser - Dernier répertoire
Résolu
nadong94
Messages postés
11
Date d'inscription
Statut
Membre
Dernière intervention
-
nadong94 Messages postés 11 Date d'inscription Statut Membre Dernière intervention -
nadong94 Messages postés 11 Date d'inscription Statut Membre Dernière intervention -
Salut à tous,
J'ai un petit problème je pense.
Lorsque je fais ceci ça fonctionne mais vu qu'il y a ces lignes en commentaires ça ne renouvel pas le dernier chemin :
Et si j'enlève les // alors j'ai un Exception :
Ce qui correspond à :
J'ai un petit problème je pense.
Lorsque je fais ceci ça fonctionne mais vu qu'il y a ces lignes en commentaires ça ne renouvel pas le dernier chemin :
public File fileChooser()
{
Preferences prefs = Preferences.userNodeForPackage(FileChooser.class);
FileChooser.lastPath = prefs.get("LastPath", System.getProperty("user.dir"));
this.setCurrentDirectory(new File(lastPath));
if (this.showOpenDialog(null) == JFileChooser.APPROVE_OPTION)
{
final double ratio = 0.009900990099009901;
ZipSecureFile.setMinInflateRatio(ratio);
File file = this.getSelectedFile();
//file = this.getCurrentDirectory();
//prefs.put("LastPath", file.getAbsolutePath());
//file.setWritable(true);
return file;
}
return null;
}
Et si j'enlève les // alors j'ai un Exception :
java.io.FileNotFoundException: M:\H2O (Accès refusé)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at EVENT.UtilityMethods.excelHDTM2Data(UtilityMethods.java:297)
at EVENT.UtilityMethods.readDataHDMT(UtilityMethods.java:270)
at EVENT.Events.btnLoad_click(Events.java:170)
at EVENT.Events.actionPerformed(Events.java:105)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener$Actions.actionPerformed(Unknown Source)
at javax.swing.SwingUtilities.notifyAction(Unknown Source)
at javax.swing.JComponent.processKeyBinding(Unknown Source)
at javax.swing.KeyboardManager.fireBinding(Unknown Source)
at javax.swing.KeyboardManager.fireKeyboardAction(Unknown Source)
at javax.swing.JComponent.processKeyBindingsForAllComponents(Unknown Source)
at javax.swing.JComponent.processKeyBindings(Unknown Source)
at javax.swing.JComponent.processKeyEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
java.io.FileNotFoundException: D:\Users\t0163126\Documents\Mes Outils Personnels (Accès refusé)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at EVENT.UtilityMethods.excelHDTM2Data(UtilityMethods.java:297)
at EVENT.UtilityMethods.readDataHDMT(UtilityMethods.java:270)
at EVENT.Events.btnLoad_click(Events.java:170)
at EVENT.Events.actionPerformed(Events.java:105)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener$Actions.actionPerformed(Unknown Source)
at javax.swing.SwingUtilities.notifyAction(Unknown Source)
at javax.swing.JComponent.processKeyBinding(Unknown Source)
at javax.swing.KeyboardManager.fireBinding(Unknown Source)
at javax.swing.KeyboardManager.fireKeyboardAction(Unknown Source)
at javax.swing.JComponent.processKeyBindingsForAllComponents(Unknown Source)
at javax.swing.JComponent.processKeyBindings(Unknown Source)
at javax.swing.JComponent.processKeyEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Ce qui correspond à :
InputStream is = new PushbackInputStream(new FileInputStream(file));
A voir également:
- Java - Problème JFileChooser - Dernier répertoire
- Waptrick java football - Télécharger - Jeux vidéo
- Jeux java itel - Télécharger - Jeux vidéo
- Eclipse java - Télécharger - Langages
- Java apk - Télécharger - Langages
- Dernier iphone - Guide
2 réponses
Bonjour,
Aussi longue soit ton exception, tout est écrit dans la première ligne :
FileNotFoundException: M:\H2O (Accès refusé)
Remarque : le code que tu nous montres n'a rien à voir avec l'erreur.
Ta méthode s'appelle fileChooser, mais la stack d'erreur n'en parle pas.
Il faudrait savoir ce que tu fais dans ces 4 lignes là...
Aussi longue soit ton exception, tout est écrit dans la première ligne :
FileNotFoundException: M:\H2O (Accès refusé)
Remarque : le code que tu nous montres n'a rien à voir avec l'erreur.
Ta méthode s'appelle fileChooser, mais la stack d'erreur n'en parle pas.
at EVENT.UtilityMethods.excelHDTM2Data(UtilityMethods.java:297)
at EVENT.UtilityMethods.readDataHDMT(UtilityMethods.java:270)
at EVENT.Events.btnLoad_click(Events.java:170)
at EVENT.Events.actionPerformed(Events.java:105)
Il faudrait savoir ce que tu fais dans ces 4 lignes là...