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?
Paul Stevens
Ranch Hand
Joined: May 17, 2001
Posts: 2823
posted
0
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.
Manfred Leonhardt
Ranch Hand
Joined: Jan 09, 2001
Posts: 1492
posted
0
Hi Amit, Try to specify your harddrive (i.e., "C:\\" ) as a parameter into the constructor and see if that works. Regards, Manfred.
Amit Rosner
Greenhorn
Joined: Dec 03, 2001
Posts: 22
posted
0
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.
Manfred Leonhardt
Ranch Hand
Joined: Jan 09, 2001
Posts: 1492
posted
0
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.
Enjoy, Manfred.
Amit Rosner
Greenhorn
Joined: Dec 03, 2001
Posts: 22
posted
0
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.
subject: Problem when using JFileChooser in JApplet