This section shows how to compile and invoke simple Java examples.
The examples are shown for Windows and MPE/iX. I don't have a Mac (sigh ;-)
D:\demo> java -version java version "1.1.7A" D:\demo> rem HowToP.java = a simple program D:\demo> javac HowToP.java D:\demo> java HowToP 4 Welcome to the HowToP program Countdown at 4 Press Return to continue Countdown at 3 Press Return to continue Countdown at 2 Press Return to continue Countdown at 1 Press Return to continue Countdown finished D:\demo> rem HowToG.java = a simple GUI program (using AWT, not Swing) D:\demo> javac HowToG.java D:\demo> java HowToG 4 ( screenshot of the GUI window ) Countdown finished D:\demo> rem HowToA.java = a simple applet D:\demo> javac HowToA.java D:\demo> appletviewer HowToA.html ( screenshot 1 of the GUI window ) ( screenshot 2 of the GUI window ) D:\demo> rem Can also view HowToA.html with a browser ( screenshot 1 of the browser window - java disabled ) ( screenshot 2 of the browser window - start of countdown ) ( screenshot 3 of the browser window - end of countdown ) D:\demo> rem HowToS.java = a simple servlet D:\demo> set classpath classpath=;D:\jdk1.1.7a\lib\classes.zip D:\demo> set classpath=%classpath%;D:\JSDK2.0\lib\jsdk.jar D:\demo> javac HowToS.java D:\demo> servletrunner -d \demo servletrunner starting with settings: port = 8080 backlog = 50 max handlers = 100 timeout = 5000 servlet dir = \demo document dir = .\examples servlet propfile = \demo\servlet.properties HowToS: init ( screenshot 1 of the browser window - start of countdown ) ( screenshot 1a of the browser window - html source ) ( screenshot 2 of the browser window - near end of countdown ) ( screenshot 3 of the browser window - end of countdown ) ( screenshot 3a of the browser window - html source ) ^C D:\demo>
:hello lars,demo.webkit :showvar hpversion HPVERSION = C.55.00 :# let's select the older JDK for this demo :setvar java_home "/usr/local/java/jdk1.1.7" :java -version java version "JDK 1.1.7B" :# HowToP.java = a simple program :chdir ./programs CWD is "/WEBKIT/PUB/programs". :javac HowToP.java :java HowToP 4 Welcome to the HowToP program Countdown at 4 Press Return to continue Countdown at 3 Press Return to continue Countdown at 2 Press Return to continue Countdown at 1 Press Return to continue Countdown finished : :# HowToG.java = a simple GUI program (using AWT, not Swing) :javac HowToG.java :# MPE/iX does not have a GUI display :# you might try RemoteAWT from alphaworks.ibm.com :# or else run the program on PC using Samba/iX... D:\> java -version java version "1.1.7A" D:\> java -classpath %classpath%;F:\PUB\programs HowToG 4 ( screenshot of the GUI window ) Countdown finished D:\> rem back to the 3000 now... :# HowToA.java = a simple applet :chdir ../htdocs CWD is "/WEBKIT/PUB/htdocs". :javac HowToA.java :stream /WEBKIT/PUB/lib/httpd.job #J144 :# surf to http://my3000.grc.hp.com:3001/HowToA.html now ( screenshot 1 of the browser window - java disabled ) ( screenshot 2 of the browser window - start of countdown ) ( screenshot 3 of the browser window - end of countdown ) :# HowToS.java = a simple servlet :chdir ../servlets CWD is "/WEBKIT/PUB/servlets". :setvar classpath ":/WEBKIT/PUB/lib/jsdk.jar" :javac HowToS.java :# optionally register servlet in /WEBKIT/PUB/etc/zone.properties :# or else run it by its real name (and with no/default initArgs) :stream /WEBKIT/PUB/lib/jserv.job #J145 :# surf to http://my3000.grc.hp.com:3001/servlet/HowToS now ( screenshot 1 of the browser window - start of countdown ) ( screenshot 1a of the browser window - html source ) ( screenshot 2 of the browser window - near end of countdown ) ( screenshot 3 of the browser window - end of countdown ) ( screenshot 3a of the browser window - html source ) :byeLars Appel, August 2000