java lab1a
.
If the application takes command line arguments, like the one in the
on-line Java tutorial,
you would type them after the class name, such as
java Newton 2
. Notice that you do not type the
.class extension of the file, but you do have to type the
.java extension when you compile.
In your labs, you will probably be provided with the .html file you need, but if you don't have it, here is a dummy one that will likely work for you.
<HTML> <BODY> <APPLET CODE="MyClass.class"> </APPLET> </BODY> </HTML>Put the above text in a file that ends in .html, such as java.html. You should change the word
MyClass.class
to whatever your .class file is.
Now, with your .class and .html sitting in
the same directory, you are ready to point a web browser at it. With
Netscape, you can start it from the command line with
netscape java.html
with
java.html
replaced with your .html file.
If you have Netscape already running, you can open it with
Open File ... under
the File menu.
There is also a program just for viewing Java applets called
appletviewer. Start it with
appletviewer java.html &
, again with your
.html file instead of java.html.
![]() |
5 The Newton's Method Example |