Error: javaw.exe - no Disk
Error Message
When loading or using a MapObjects-Java based application, the following error may occur:
Code:
javaw.exe - no Disk
There is no disk in the drive. Please insert a disk into drive A:.
Cause
This issue has been logged as a bug with Java and is frequently encountered when dealing with the SecurityManager and Java applets in some environments, such as browser and Java Web Start. See the link in the Related Information section the Sun bug report.
The use of some core Java classes in MapObjects-Java may cause an applet's SecurityManager to attempt to access available drives, including A if available. For example, creating a javax.swing.JFileChooser object will, by default, try to access all drives. MapObjects uses the JFileChooser object when saving AXL files.
Solution or Workaround
The following workaround overrides the SecurityManager and ignore reading the A drive.
- Create a new class; this can be an inner class:
Code:
class MySecurityManager
extends java.lang.SecurityManager {
private static final String DRIVE_A = "A:\";
public void checkRead(String filename) {
if (!DRIVE_A.equals(filename)){
super.checkRead(filename);
}
}
} - Add the following lines to the application, usually in the applet's main class, that references the custom SecurityManager:
Code:
public class DiskApplet extends JApplet {
MySecurityManager msm = new MySecurityManager();
public void init(){
System.setSecurityManager(msm);
...
Related Information
Last Published: 5/5/2016
Article ID: 000008022