-
Bug
-
Resolution: Not an Issue
-
P2
-
None
-
1.0
-
sparc
-
solaris_2.5
>From: Pria Graves <###@###.###>
This does not look like form output to me.
I have encountered something I believe to be a bug (or at least a
documentation problem). I am running Solaris 2.4 (redirected to a SunOS
machine), doing development with the JDK downloaded on January
25th. The problem occurs ONLY when running with the java interpreter.
I am not experiencing this problem when running with either Netscape
2.0 or the appletviewer.
The problem comes when I attempt to do a getImage to retrieve an
icon. It appears that the getImage method calls getAppletContext,
which returns a null pointer. Here's the messages:
java.lang.NullPointerException
at java.applet.Applet.getAppletContext(Applet.java:83)
at java.applet.Applet.getImage(Applet.java:120)
at Demo.init(Demo.java:27)
at Demo.main(Demo.java:14)
Here's the code. Is there something I'm missing? It makes no
difference whether the url is in file or http format...
// Applet : Demo
import java.awt.*;
import java.lang.*;
import java.applet.*;
import java.net.*;
public class Demo extends Applet implements Runnable
{
private Image img = null;
public static void main(String args[])
{
Frame frame = new Frame("Health Monitor Lite");
Demo demo = new Demo();
demo.init();
frame.add("Center", demo);
frame.show();
}
public void init()
{
super.init();
URL url = null;
try {
url = new URL("file:/users/priag/java/gauge/images/2500.xbm");
}
catch(MalformedURLException e);
img = getImage(url);
}
public void run()
{
System.out.println( " you are running");
}
}
Thanks,
Pria