Programming Center
Java Platform Overview |
Getting Started |
To set up the Java platform on your computer, you need to download the developer kit, then set up whatever development environment you plan on using. You can also do this in one step by downloading the JDK that comes bundled with the NetBeans IDE.
Step 1: Download the JDK
Once you've installed the JDK download on your computer, set up should be complete. You may, however, want to set the classpath as an environment variable. See the installation notes for directions on how to do that for your operating system. If you want to develop web applications, you need to use either the NetBeans IDE, Sun Java Studio Creator IDE, or Sun Java Studio Enterprise in addition to the JDK, as these environments provide a web server that's necessary for creating and testing servlets, JavaServer Pages, and database connections. See Getting Started with an Integrated Development Environment (IDE) if you're unsure which IDE would best suit your development needs. Step 2: Set Up a Development EnvironmentIf you downloaded the JDK with the NetBeans IDE, start NetBeans, and begin programming.
You can also program using a simple text editor, and compile and run from the command line. Many text editors now come with the ability to run and compile Java files, but you may need to tell the program where Next, copy and paste the following programs, and invoke the compiler and interpreter either at the command line or within the IDE you're using.
The following three examples use the
When compiling and running from the command line, be sure to Application
Compile the
Compile and then run with the following commands: javac ExampleProgram.java java ExampleProgram Applet
Copy the
Compile: javac SimpleApplet.java You 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:
To run the applet in the browser, you load the HTML file. To run the
applet in appletviewer with an HTML file named appletviewer simple.html Servlet
As mentioned above, to compile and run a servlet, you need to use either NetBeans or Sun Java Studio Creator.
Then compile with the
To compile: javac ExampServlet.java Servlets 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.
| ||||||||||
Oracle is reviewing the Sun product roadmap and will provide guidance to customers in accordance with Oracle's standard product communication policies. Any resulting features and timing of release of such features as determined by Oracle's review of roadmaps, are at the sole discretion of Oracle. All product roadmap information, whether communicated by Sun Microsystems or by Oracle, does not represent a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. It is intended for information purposes only, and may not be incorporated into any contract.
|
| ||||||||||||