Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Start:applet not initialized Error

 
Rakesh Chaudhary
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Rakesh Chaudhary
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Sheriff...I was so STUPID.......
 
Gauri Kudtarkar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can any one tell me how to run applet?
 
SeregaSuper Tramp
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
for console based way you can check below url

http://www.cs.colostate.edu/helpdocs/JavaInDOS.html
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic