Author
Start:applet not initialized Error
Rakesh Chaudhary
Ranch Hand
Joined: Feb 19, 2008
Posts: 118
I experts I have problem displaying a button on a applet ....The following is the code I am getting a error i.e Start :Applet not initialized /*<applet code="basic.Applet2.class" width=400 height=500> </applet> */ //package basic; import java.applet.Applet ; import java.awt.Button ; public class Applet2 extends Applet { Button b; public void init() { b=new Button(); add(b); } }; And the story is same for all other applet applications...Please help
Acquire the unexpected.......
Preparing for SCJP 6
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 32767
posted Apr 29, 2008 05:40:00
0
If you comment out the "package basic" declaration, then you can't refer to the class as "basic.Applet2". Check the Java Console; it should show an error message to this effect.
Android apps – ImageJ plugins – Java web charts
Rakesh Chaudhary
Ranch Hand
Joined: Feb 19, 2008
Posts: 118
Thanks a lot Sheriff...I was so STUPID.......
Gauri Kudtarkar
Greenhorn
Joined: Jan 04, 2011
Posts: 2
Can any one tell me how to run applet?
SeregaSuper Tramp
Greenhorn
Joined: Nov 04, 2011
Posts: 1
Gauri Kudtarkar wrote: Can any one tell me how to run applet?
Hi,Gauri. You may simply start the command line and type, the following
>notepad MyApplet.java
this will create a java file where you place a code of your applet.Then you should complile it with java compiler in this way:
>javac MyApplet.java
After complilation will be produced byte-code with .class extension. CHeck if it has worked out by cheking the directory:
>dir /p
Since every applet is being run in the browser, you should create also a html page, in context of which your applet will be run:
>notepad myPage.html
In the page write the following code(don't forget to save changes):
<html>
<applet code="MyApplet" width=600 height=500>Hello World</applet>
</html>
you can run this html page with a appletviewer in such way
>appletviewer myPage.html
gyan kumar
Ranch Hand
Joined: Sep 28, 2011
Posts: 61
In short first your java file should be compiled
and
after that use .class file in html file and see in IE/FF etc browsers.
gyan kumar
Ranch Hand
Joined: Sep 28, 2011
Posts: 61
for console based way you can check below url
http://www.cs.colostate.edu/helpdocs/JavaInDOS.html
subject: Start:applet not initialized Error