How to install JAVA programming environment in XP system? JAVA runtime environment configuration method detailed

  
                

Most of today's programming users need to use the JAVA environment. Mastering the installation, configuration, and operation of JAVA is an important element in programming users' programming environment. It also needs to be mastered as a senior programmer. Some users may be unfamiliar with the JAVA environment configuration. You can read the following how to install, configure, and use the XP system JAVA.

master download java sdk package, and run Java programs written in Java runtime environment settings and methods. Download and install JDK, use environment variables, use Jcreator4.0, compile Java source programs, run Java programs, and compile and run programs with Jcreator.

Operation steps:

A JDK download and installation

1, machine requirements

Java does not require high machine operation. The machine requirements based on the Windows platform are given below.

Hardware requirements: CPU PIV, 128M memory, 1G hard disk space

Software requirements: Windows 2000/XP/win7, IE6.0

2. Download JDK< Br>

In order to build an SDK-based Java runtime environment, you need to download Sun's free SDK package first. The SDK includes a complete set of development tools, including the most useful for programming, the Java compiler, the Applet viewer, and the Java interpreter. Enter http://java.sun.com into the official website of Sun Company in the browser. The latest version of the JDK package (JDK1.6) can be found in the "Popular www.gzlij.com Downloads" column on the right side of the page and downloaded.

3, install SDK

Run the downloaded "jdk-5u1-windows-i586-p.exe" package, you can set the installation path and select components during the installation process, the default The component selection is all installed. After the installation is successful, the bin folder contains executable files such as compiler (javac.exe), interpreter (java.exe), applet viewer (appletviewer.exe), and the lib folder contains All the libraries are used to develop Java programs, and the demo folder contains examples of open source code programs.

4, JDK main folder and file

After the installation is successful, the file and subdirectory structure of d:\\java\\jdk1.5 is shown in Figure 1.1. The bin folder contains executable files such as compiler (javac.exe), interpreter (java.exe), and applet viewer (appletviewer.exe). The lib folder contains all the libraries for developing Java programs. The sample folder contains an open source code program instance, and the src compressed file contains the class library open source code.

END

Second, set environment variables

The tools in JDK are command line tools, you need to run them from the command line, MS-DOS prompt. Many people may not be used to it, but this is Sun's deliberate strategy to focus more on the Java language itself than on development tools. Take Windows XP as an example to illustrate the setup process.

1. Right click on the desktop “My Computer” icon, select “Properties"Menu

2. Click on the "Environment variable in the "Advanced" tab ” button, will appear "Environment Variables" setting interface

3, in the "System Variables" box click “ New & rdquo; button, in the "Edit System Variables" dialog In the box, type "JavaHome" in the text box of the "Variable Name" column, and enter "ld:;d:\\java\\jdk1.5” in the text box of the variable value column (that is, the main directory of jdk installation)< Br>

4. Select “path” in the “System Variables” box, and then click the “Edit” button to display the “Edit System Variables” dialog box in the “Edit Variables” dialog box. Add “;%JavaHome%\\bin” after the value of the column.

5, in the "System Variables" box, click the "New" button, in the "New System Variables" dialog box that appears, in the "variable name" column Enter “classpath” in the variable value field, enter “. ;%JavaHome%\\lib”. Where “. ” indicates the current directory.

6. After the setting is completed, click “Start”-"<quo;All Programs"-"";Accessories"-""Command Prompt" Open DOS window at command line At the prompt, enter “java” or “javac” After the carriage return, if the usage parameter prompt message appears, the installation is correct.

END

Third, use Jcreator

1. To write a Java program, you need a text editor. You can use the notebook provided by the operating system as an editor. It is best to choose Jcreator editing software. It can display java keywords and class names in different colors. It is easy to use and can compile and run java source programs.

(1) Download and install Jcreator editing software

(2) Suppose you intend to write text on the screen “Hello World! ” file (Hello.java). First open the Jcreator editing software as shown.

2, click the File menu & mdash; "New & mdash;" File, fill in the source file name Hello.java and the file storage location E: \\, as shown.

3. Click the “Finish” button to create a new Hello.java source, as shown, and enter the following code (with blue shades):
System.out.println( <;Hello World!”);

END

Fourth, compile java source

After the Java source is written, use the Java compiler (javac.exe) to compile, Compile the Java source into executable program code. Java source programs are files with a .java extension. At compile time, first read the Java source program, then perform a syntax check and terminate the compilation if there is a problem. After the grammar check is passed, the executable program code is generated, that is, the bytecode, the bytecode file name and the source file name are the same, and the extension is .class.

1. Open a command prompt window and enter the path where the java source program is located.

2, type the compiler and the source file name to be compiled: javac Hello.java. Press Enter to start compiling. If the source program has no errors, there is no output on the screen as shown.

END

V. Running Java Programs

Use the java compiler (java.exe) to interpret the compiled bytecode file Hello.class as local computer code. . In the Command Prompt window, type the interpreter and the bytecode file name to be interpreted, java Hello. Press the Enter key to start executing the program and output the result. Note: The bytecode file is case sensitive.

END

6. Compile and run Java programs using Jcreator

1. Click on the "Compile File" button in the toolbar to compile the program.

2. Click the &Exquo;Execute” button to execute the program.


The above is about the XP system installation, configuration, use of JAVA, as an important part of the programming family, in fact, the tools used are not much to say, the software described above Just look at personal habits, compile JAVA is easy, user, what do you think?

Copyright © Windows knowledge All Rights Reserved