This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi! I have a signed applet in which I want to use JFileChooser. The problem is: whenever the execution gets to the line: "JFileChooser chooser = new JFileChooser()" I get a modal dialog box saying: "There is no disk in the drive. Please insert a disk into drive A:". The title of the dialog is: "javaw.exe - No Disk". When I press "Cancel" or "Continue" the file chooser opens regularly and I can browse the file system with no problem. When I tried to use an application instead of the applet, this phenomenon disappears and the chooser opens without the dialog. How can I avoid this?
I will try to remember what if anything we did when we encountered this error. I do remember that it happened on laptops when the last drive accessed before getting into the app was the cd/rom drive. The laptops had no A: at the time. The person I need to talk to is on vacation so I will have to check with him.
Hi Amit, Try to specify your harddrive (i.e., "C:\\" ) as a parameter into the constructor and see if that works. Regards, Manfred.
Joined: Dec 03, 2001
Hi Manfred and Paul! No, it doesn't work. As a matter of fact it shouldn't make any difference, because I never change my default directory, and moreover, I never change my default drive. I just call the constructor of JFileChooser, and I still get that modal dialog. And as I mentioned, in an application it works fine. It only appears in a JApplet. Please try to see if any of you has the same problem (start a new JApplet project and just try to create a JFileChooser object). Amit.
Joined: Jan 09, 2001
Hi Amit, After some looking around, it seems that there is a Java bug in JFileChooser when used with a JApplet. It seems to be a problem with the SecurityManager and the CheckRead function. A workaround, I have figured out is shown below.
Joined: Dec 03, 2001
Hi again! Thanks Manfred, it really solved the problem. Still, I don't understand why that bug exists and why Sun doesn't fix it. I didn't find any documentation in Sun about it, which makes it even more strange. Amit.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Problem when using JFileChooser in JApplet