Most notable is what it does not contain:
should give
java version "1.2.1" Solaris VM (build Solaris_JDK_1.2.1_02, native threads, sunwjit)or something similar.
Compile with
javac programname.java
Run applications with
java programname
Run applets with
appletviewer programname.java
This assumes that your java source has an HTML heading as a comment.
/* < Applet code = ShowD width = 400 height = 300 > < /Applet > */ import java.applet.Applet; import java.awt.*; import java.awt.event.*; public class ShowD extends Applet implements ActionListener { Label prompt; TextField input; double val; public void init() { prompt = new Label("Enter a number"); add(prompt); input = new TextField(20); input.addActionListener(this); add(input); setBackground(Color.cyan); } public void paint(Graphics g) { g.drawString("The number is: "+val,50,80); g.drawString("One hundred times the value is: "+100*val,50,110); g.drawString("This program was modified by Steven Robbins",50,150); } public void actionPerformed(ActionEvent e) { if (e.getSource() == input) { val = Double.valueOf(input.getText()).doubleValue(); repaint(); } } }Compile this with:
This creates a file called ShowD.class
Run this using:
appletviewer ShowD.java
Put it on the web!