?
Solved

java filecheeser error on UNC path

Posted on 2007-07-31
3
Medium Priority
?
834 Views
Last Modified: 2013-11-23
Hi the following code get exception when try to use a network share path like \\computer_name\share_name. For local directory no problem. And there is no permission problem on share...
-------------------------------------------------------------------------------------
      JFileChooser fc = new JFileChooser();
      fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
      fc.setAcceptAllFileFilterUsed(false);
      int retval = fc.showOpenDialog(frame);

      if(retval == JFileChooser.APPROVE_OPTION){
            String path = fc.getCurrentDirectory().toString();
            System.out.println(path);
      }else {
            System.out.println("No Selection ");
      }
-----------------------------------------------------------
Exception in thread "Basic L&F File Loading Thread" java.lang.InternalError: Unable to bind \\computer_name\share_name to parent
      at sun.awt.shell.Win32ShellFolder2.getIShellFolder(Win32ShellFolder2.java:322)
      at sun.awt.shell.Win32ShellFolder2.listFiles(Win32ShellFolder2.java:538)
      at javax.swing.filechooser.FileSystemView.getFiles(FileSystemView.java:422)
      at javax.swing.plaf.basic.BasicDirectoryModel$LoadFilesThread.run(BasicDirectoryModel.java:195)
 
___________________________________________
0
Comment
Question by:karanba
3 Comments
 
LVL 7

Expert Comment

by:ravs120499
ID: 19599643
Is \\comp\share already connected - JFileChooser cannot show an authentication dialog.

What version of Java are you on, and what platform?
0
 

Author Comment

by:karanba
ID: 19600253
java version "1.4.2_03"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.
Java HotSpot(TM) Client VM (build 1.4.2_03-b02, mixed mode)

On windows xP machine

\\comp\share  is not connected, there is no need authenticaiton its public to everyone.
0
 
LVL 20

Accepted Solution

by:
gatorvip earned 2000 total points
ID: 19602192
This is a bug in your version of JDK when using DIRECTORIES_ONLY mode. See here:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5102604
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6180936
Also,  4356160  , 5086831  

The first link contains a workaround if you cannot upgrade to JDK 6.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses
Course of the Month14 days, 9 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question