Help with First Cup of Java Tutorial
Hello everyone,
I am new to java (just downloaded the J2SE 1.4.2 SDK and am running on a Windows 2000 system) and have started my learning process by going through the First Cup of Java tutorial. I completed the tutorial, ran my hello.html from the appletviewer. The appletviewer displayed the desired "Hello World!" text and everything seems great. My question is..... when I open the Hello.html file from my Microsoft Internet Explorer, my screen displays"Here is the output of my program: " followed by a gray box. Shouldn't "Hello World" be in the gray box?Why is the appletviewer different than my browser?
Thanks in advance.
Janet
Here is the file Hello.html:
<HTML>
<HEAD>
<TITLE>A Simple Program</TITLE>
</HEAD>
<BODY>Here is the output of my program:
<APPLET CODE="HelloWorld.class" WIDTH=150 HEIGHT=25
></APPLET>
</BODY>
</HTML>
Here is the HelloWorld.java file that I compiled using javac to get my .class file:
import java.applet.*;
import java.awt.*;
public class HelloWorld extends Applet {
public void paint(Graphics g) {
g.drawString("Hello World!", 50, 25);
}
}
Here are the results from the java console:
Error loading class: HelloWorld
java.lang.NoClassDefFoundError
java.lang.ClassNotFoundException: HelloWorld
at com/ms/vm/loader/URLClassLoader.loadClass
at com/ms/vm/loader/URLClassLoader.loadClass
at com/ms/applet/AppletPanel.securedClassLoad
at com/ms/applet/AppletPanel.processSentEvent
at com/ms/applet/AppletPanel.processSentEvent
at com/ms/applet/AppletPanel.run
at java/lang/Thread.run
Error loading class: HelloWorld
java.lang.NoClassDefFoundError
java.lang.ClassNotFoundException: HelloWorld
at com/ms/vm/loader/URLClassLoader.loadClass
at com/ms/vm/loader/URLClassLoader.loadClass
at com/ms/applet/AppletPanel.securedClassLoad
at com/ms/applet/AppletPanel.processSentEvent
at com/ms/applet/AppletPanel.processSentEvent
at com/ms/applet/AppletPanel.run
at java/lang/Thread.run
Thanks for telling me about the java console, I'm not sure what the error message is telling me.
The files are both in the same directory... I do not see anywhere in
IE where I can set it up to use Sun Java.
> I think if you have Hello.html and Hello.class in the
> same directory and have Internet Explorer configured
> to use Sun Java then it will work.