Symbian
Symbian OS Library

FAQ-0263 Applet will not run as application

[Index][spacer] [Previous] [Next]



 

Classification: Java Category: Applet
Created: 07/16/99 Modified: 08/01/2001
Number: FAQ-0263
Platform: ER5

Question:
I have written an applet called MyApplet which incorporates a main() method so that it can be run as an application, instantiating itself in the following line:
myApplet= (MyApplet)java.beans.Beans.instantiate(iiClsLoader,"MyApplet");
It runs fine both as an applet and as an application on JDK1.1.8 . It also runs fine as an applet in Web, but falls over when run as an application both on the EPOC emulator and on EPOC machines with the following error message:
java.net.MalformedURLException: systemresource:/FILE./+/:
java.lang.SecurityException: systemresource:/FILE./+/
refers to a non system resource
and citing the above line of code as the cause.


Answer:
This is not a defect of ER5 Java as such but rather a limit intrinsic to Java 1.1.4, on which ER5 Java is based. It arises because the default behaviour of the Java runtime is to try to establish the codebase of any applet. If the "applet" is running as an application, the parsing of the codebase fails and the SecurityManager which controls applets' runtime behaviour throws an exception.
This problem was fixed in Java 1.1.5 and has been fixed in future releases of Symbian Java. But it is unfortunately not possible to work around the problem in ER5.