Results 1 to 5 of 5
  1. #1
    Manfizy's Avatar
    Manfizy is offline Senior Member
    Join Date
    Nov 2008
    Location
    Germany
    Posts
    193
    Rep Power
    6

    Post JFileCjooser--java.lang.RuntimeException: java.io.IOException: Could not get shell fo

    Hi, i get an error java.lang.RuntimeException: java.io.IOException: Could not get shell folder ID list
    when i try to use JFile chosser

    does anybody know how to woh around this proble?

    Java Code:
    Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: java.io.IOException: Could not get shell folder ID list
            at sun.awt.shell.Win32ShellFolderManager2$ComInvoker.invoke(Win32ShellFolderManager2.java:506)
            at sun.awt.shell.Win32ShellFolder2.getFileSystemPath(Win32ShellFolder2.java:563)
            at sun.awt.shell.Win32ShellFolderManager2.getRecent(Win32ShellFolderManager2.java:112)
            at sun.awt.shell.Win32ShellFolderManager2.get(Win32ShellFolderManager2.java:251)
            at sun.awt.shell.ShellFolder.get(ShellFolder.java:219)
            at sun.swing.WindowsPlacesBar.<init>(WindowsPlacesBar.java:64)
            at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.updateUseShellFolder(WindowsFileChooserUI.java:512)
            at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.installComponents(WindowsFileChooserUI.java:194)
            at javax.swing.plaf.basic.BasicFileChooserUI.installUI(BasicFileChooserUI.java:136)
            at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.installUI(WindowsFileChooserUI.java:127)
            at javax.swing.JComponent.setUI(JComponent.java:673)
            at javax.swing.JFileChooser.updateUI(JFileChooser.java:1763)
            at javax.swing.JFileChooser.setup(JFileChooser.java:360)
            at javax.swing.JFileChooser.<init>(JFileChooser.java:333)
            at javax.swing.JFileChooser.<init>(JFileChooser.java:286)
            at MyXenonConc.XenonConcUI.jMenuItem3ActionPerformed(XenonConcUI.java:1909)
            at MyXenonConc.XenonConcUI.access$300(XenonConcUI.java:31)
            at MyXenonConc.XenonConcUI$7.actionPerformed(XenonConcUI.java:1267)
            at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
            at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
            at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
            at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
            at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
            at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1225)
            at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1266)
            at java.awt.Component.processMouseEvent(Component.java:6134)
            at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
            at java.awt.Component.processEvent(Component.java:5899)
            at java.awt.Container.processEvent(Container.java:2023)
            at java.awt.Component.dispatchEventImpl(Component.java:4501)
            at java.awt.Container.dispatchEventImpl(Container.java:2081)
            at java.awt.Component.dispatchEvent(Component.java:4331)
            at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4301)
            at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3965)
            at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3895)
            at java.awt.Container.dispatchEventImpl(Container.java:2067)
            at java.awt.Window.dispatchEventImpl(Window.java:2458)
            at java.awt.Component.dispatchEvent(Component.java:4331)
            at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
            at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
            at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    Last edited by Manfizy; 06-17-2009 at 04:13 PM.
    We Learn Through Mistakes..,
    Manfizy:rolleyes:

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is online now Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,419
    Rep Power
    20

    Default

    Post your code, in the form of an SSCCE.
    SSCCE : Java Glossary

    db

  3. #3
    Manfizy's Avatar
    Manfizy is offline Senior Member
    Join Date
    Nov 2008
    Location
    Germany
    Posts
    193
    Rep Power
    6

    Post

    what i posted above is the error that i get when i try to invoke JFileChooser.

    Am tempted to think that its something to do with windows Look and feel not accepting the way i am using JFileChooser because if i use another LookAndFeel it works properly.

    This is how i am doing it

    Java Code:
    final JFileChooser fc = new JFileChooser();
    
    fc.setCurrentDirectory(new File("."));
    
    int returnVal = fc.showOpenDialog(jMenuItem3);
    
    if(returnVal == JFileChooser.APPROVE_OPTION) {
       File file = fc.getSelectedFile();
    
       String f =file.getName();
    try {
    
    //At this point i read data in the file 
    ......
    ......
    }catch (IOException e) {
          e.printStackTrace();
         }
    And for the look and feel, this is how i implement it

    Java Code:
      public static void main(String args[]) {
              java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    try {
                        UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
    
                    } catch (ClassNotFoundException ex) {
                        Logger.getLogger(XenonConcUI.class.getName()).log(Level.SEVERE, null, ex);
                    } catch (InstantiationException ex) {
                        Logger.getLogger(XenonConcUI.class.getName()).log(Level.SEVERE, null, ex);
                    } catch (IllegalAccessException ex) {
                        Logger.getLogger(XenonConcUI.class.getName()).log(Level.SEVERE, null, ex);
                    } catch (UnsupportedLookAndFeelException ex) {
                        Logger.getLogger(XenonConcUI.class.getName()).log(Level.SEVERE, null, ex);
                    }
    
                 new XenonConcUI().setVisible(true);
               }
            });
        }
    We Learn Through Mistakes..,
    Manfizy:rolleyes:

  4. #4
    Webuser is offline Senior Member
    Join Date
    Dec 2008
    Posts
    526
    Rep Power
    0

    Default

    fc.setCurrentDirectory(new File("."));
    Actually, as a rule, File class demands for an absolute file path or just a project package path... Try to use list method instead...
    Report if that helped )

  5. #5
    Manfizy's Avatar
    Manfizy is offline Senior Member
    Join Date
    Nov 2008
    Location
    Germany
    Posts
    193
    Rep Power
    6

    Post

    Actually when i run the same program in vista using the windows look and feel i dont get errors but if i run it in XP i get the error. I dont understand why it has to be that way. Anyway, am going to try your method and give you feed back

    cheerz!
    We Learn Through Mistakes..,
    Manfizy:rolleyes:

Similar Threads

  1. Replies: 2
    Last Post: 09-18-2008, 07:30 AM
  2. Error: unreported exception java.io.IOException; ??
    By jonsamwell in forum New To Java
    Replies: 5
    Last Post: 08-24-2008, 04:11 AM
  3. Replies: 3
    Last Post: 04-10-2008, 09:01 AM
  4. java.io.IOException: invalid header field
    By osval in forum Advanced Java
    Replies: 1
    Last Post: 08-06-2007, 11:09 PM
  5. java.lang.RuntimeException+ Axis
    By Peter in forum Advanced Java
    Replies: 1
    Last Post: 07-05-2007, 01:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •