JDK use
Abstract: the use JDK
<table Width="100%" height="92%" border="0" cellpadding="6" cellspacing="0"> <tr> <td height = "623" align = "left" valign = "top" class = "content"> First Coffee Cup
— On your first detailed briefing on the procedures presented below will help you to complete the first Java programs. These presentations are for Win32 operating platform users. We will give you a list of things needed. The briefing will involve the creation of an independent operational procedures (Application) and small procedures (Applet) the creation of steps, and you have to explain the problems that may be encountered.
— 1. List 2. Create your first independent operation procedures (Application)
A. create Java source.
B. compiler source ?????
C. run this process 3. Create small programs (Applet)
1. Your list in order to complete the first procedure, you need to: 1. Java 2 Platform, Enterprise Edition standards (Java 2 Platform, Standard Edition), you can download here,
2. Text editor. For example, using Notepad, the Windows platform most simple text editor. Both are necessary, you may intend to install integrated compiler environment, you can choose Forte for Java, or JBuilder.2. Creation of an independent operating procedures (Application), a procedure HelloWorldApp, shows only welcome the word "Hello world! . "according to the following steps:> create source files. Source document contains the text of the Java syntax. > Compile the source files into bytecode files. Compiler, javac, and the original document compiled into Java virtual function identification directives. > Run the bytecode files. Executive explained, java, read bytecode files, and its translation into the operating system can understand the implementation of the directive. Can be summarized as: source (HelloWorld.java) -> bytecode files (HelloWorld.class) -> binary files (?.?) notepad -> compiler -> explanation for the implementation of a. create source files, you can have two option 1. HelloWorldApp.java download files to your computer, eliminating a lot of trouble. 2. Wordy or below the steps.
1. Notepad, enter the following code: / **
* The HelloWorldApp class implements an application that
* Displays "Hello World!" To the standard output.
* /
(Public class HelloWorldApp
Public static void main (String [] args) (
/ / Display "Hello World!"
System.out.println ( "Hello World!");
)
)
Note: Java compiler interpreter is case-sensitive. So HelloWorldApp does not mean helloworldapp 2. HelloWorldApp.java preserve documents, the directory C: java b. compiler source from the Start menu, choose MS-DOS, a DOS window, enter C: java, in the command line input, javac HelloWorldApp.java.
If no error message, you build success, but more likely there is an error message:
Bad command or file name
This means that the operating system did not find Java compiler, javac. You can assume that your JDK solution? Installed in the C: jdk1.2.1, then you can enter on the command line: C: jdk1.2.1 injavac HelloWorldApp.java premise for the current directory C: java under.
However: If you must enter each such trouble orders, in order to avoid trouble, which is a good approach. You set up the environment variables: path. After the bytecode compiler produce documents, HelloWorldApp.class date you already have. Class document. You can run the procedure. 3. Creating Java applets (applet) HelloWorldApp is an independent operating procedures (application) example. Below you on how to create a Java applet (applet), this procedure is to show that: HelloWorld!, But the difference is that it runs in support of Java browser, such as: Micosoft Internet Explorer.? Steps to create small programs and basically the same as before: to create source -> compiler source -> a. operating procedures to create Java bytecode source at this time you have two choices:> here and MyJava.html HelloWorld.java download, and then you can go directly to steps b> in a notepad, type: import java.applet .*;
Import java.awt .*;
/ **
* The HelloWorld class implements an applet that
* Simply displays "Hello World!."
* /
Public class HelloWorld extends Applet (
Public void paint (Graphics g) (
/ / Display "Hello World!"
G.drawString ( "Hello world!", 50, 25);
)
)
HelloWord.java for its depositors, the directory C: java In addition you want to build a. Html document: one type:
<head>
</ Head>
<body>
Here is the output of my program:
</ Body>
Save as: MyJava.html. Directory C: javac. Running the program with a direct MyJava.html open IE, you will be able to see in the browser HelloWorld words. Another type on the command line: appletviewer MyJava.html? See what happened if, in a graphical interface, and a HelloWorld! Words, even if successful. </ Td> </ tr> </ table> </ td> </ tr> </ table>
↑ Back
Tags: java jdk






