HELP! * YELLOW=global GREY=local Global HTML version of Foils prepared 1 February 97

Foil 32 Java Applets

From Jan 22 Delivered Lecture for Course CPS616 -- Java Lecture 1 -- Overview CPS616 spring 1997 -- Jan 22 1997. by Nancy McCracken * See also color IMAGE
Secs 123.8
Java applets are classes written in Java which are intended not to run as stand-alone programs (as applications do) but as subprograms of a browser which is already managing a window.
Applets should NOT have main method but rather init, start, paint etc. for displaying on the browser window
The applet should be run through javac compiler getting a .class file as before:
    • javac MyApplet.java
Also create an HTML file (say MyApplet.html) with an applet tag.
Two ways to run an applet:
  • If you have JDK on one's machine, one can run the applet with appletviewer
    • appletviewer MyApplet.html
  • Alternatively, run Netscape 2.0 essentially anywhere, point the browser at MyApplet.html, and applet is downloaded from the webserver and run by Java interpreter built into Netscape. This requires that the .html and .class files are located in the document space of the web server.
This way we can compile on places with JDK installed but run almost anywhere!


Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sun Feb 16 1997