![]() ![]() ![]() |
|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Getting StartedTo write any JavaTM program, you need to download the development kit for J2SE for Windows , for Solaris or the The Outlaw Cafe: A Site Devoted to Java Development on the Mac for Mac users.Development kits are also available in other languages. Next set up the software, and then configure your system. Next you need to learn how to invoke the compiler and interpreter.
The following three examples use the ApplicationCompile the
ExampleProgram.java application with the javac command and
run it with the java command.
javac ExampleProgram.java java ExampleProgram AppletCompile the
SimpleApplet.java applet
with the javac command.
javac SimpleApplet.javaYou can run the applet in appletviewer (a Java platform tool for running applets independently of the browser) or in the browser. Either way you need an HTML file for the applet. Here is the HTML file: <HTML> <BODY> <APPLET CODE=SimpleApplet.class WIDTH=200 HEIGHT=100> </APPLET> </BODY> </HTML>To run the applet in the browser, you load the HTML file. To run the applet in appletviewer with an HTML file named simple.html ,
type this in an MS-DOS window on Windows, or in a terminal window on Solaris:
appletviewer simple.html ServletTo compile the
ExampServlet.java
servlet you will also need to install the JavaServerTM Web Development Kit and add it to your class path as you did for the J2SE. Then compile with the javac command.
javac ExampServlet.javaServlets can be called directly by typing their uniform resource locator (URL) into a browser's location window after you've started the server.
Servlets can also be invoked from an HTML form by specifying their
URL in the definition for a Servlets can be called by any program that can open an hypertext transfer protocol (HTTP) request.
Reader FeedbackTell us what you think of this information.
|