how run applet in command prompt

Learn Java Programming for Beginners

how to run applet in appletviewer

we can run applet in two ways first is run applet using html and second is run applet using appletviewer
1.click on start then run.

How to run applet using appletviewer

How to run applet using appletviewer

2. type cmd in run

How to run applet using appletviewer

How to run applet using appletviewer

3.type javac A.java(Filename .java)
appletviewer A.java(Filename.java)

How to run applet using appletviewer

How to run applet using appletviewer

4. output is like this

How to run applet using appletviewer

How to run applet using appletviewer

A.java file contains

import java.applet.*;
import java.awt.*;
/*<applet code="A" width="300" height="300"> </applet>*/
public class A extends Applet
{
public void paint(Graphics g)
{
g.drawRect(50, 50, 200, 200);
}
}

we can run applet in two ways first is run applet using browser and second is run applet using appletviewer

1.create file (filename).java

Example:

A.java contains

import java.applet.*;
import java.awt.*;
public class A extends Applet
{
public void paint(Graphics g)
{
g.drawRect(50, 50, 200, 200);
}

}

2. create HTML file

(anyname).html contains

<html>
<p> This file launches the 'A' applet: A.class! </p>
<applet code="A.class" height=200 width=320>
No Java?!
</applet>
</html>

3.open cmd type javac (filename).java
now type (filename).html

allow blocked content to run applet..

Facing difficulties in understanding the program ?

Ask Your Queries in Comment Box

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *