by Dinesh Thakur Category: AWT and Applets

In this CommandLineApplet example You can see an applet program run from command Line without using any web browser.


import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
public class CommandLineApplet extends Applet {
public static void main(String[] args) {
Frame ComApplet = new Frame("Applet from Command Line");
ComApplet.setSize(350, 250);
Applet CommandLineApplet = new CommandLineApplet();
ComApplet.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
  public void paint(Graphics g) {
    g.setFont(new Font("Arial",Font.BOLD,14));
    g.drawString("Applet from Command Line", 100, 100);

Compiling Applets:


Running Applet from console:

java CommandLineApplet

Run Applet from Command Line

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.C.A, MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.

Related Articles