Build a Java Development Environment
Not every computer can run a Java program. To run a Java program, the computer must build a Java development environment. To compile a Java program, you can use any text editing tool, for example, notepad is one of the simplest text editing tools.
To download JDK, follow these steps:
1. Open the browser and enter the following URL in the address bar of the browser:
Http://www.oracle.com/technetwork/java/javase/downloads/index.html
The interface is as follows:
2. Click the red area in the figure.
The interface is as follows:
3. Select an installation file suitable for your system and download it.
Follow these steps to install JDK:
1. Double-click the downloaded JDK installer to go to the installation page. First, go to the Installation Wizard Page,
2. Click "Next" to go to the custom installation page,
3. Select the program to be installed. To change the installation location, click "change" and select the installation location. Click "Next" to start installation.
|
Note: When installing JDK, There is no shortcut and no shortcut is required. Therefore, the methods and classes in it are implicitly called by a program compiled by a programmer. |
Configure and test JDK in Windows
After installing JDK, you need to set the environment variables and test whether the JDK configuration is successful. The specific steps are as follows:
1. Right-click the "computer" icon, select the "properties" command, and select the "advanced" tab in the "advanced system settings" dialog box;
2. Click the "environment variables" button to open the "environment variables" dialog box. Here, you can add "User variables" for a single user and "system variables" for all users ";
3. Click "new" in the "System variables" column to bring up the "Edit System variables" dialog box. In the "variable name" text box, enter "java_home ", in the variable value text box, enter the JDK installation path "C: \ Program Files \ Java \ jdk1.6.0 _ 24" and click "OK, complete the configuration of the environment variable "java_home.
4. Check the PATH variable in the system variable. If the PATH variable does not exist, create a new variable path. Otherwise, select the variable and click "edit" in the "environment variable" dialog box, open the "Edit System variables" dialog box, and add "% java_home % \ bin;" to the start position of the "variable value" text box in the dialog box ;", click OK to complete environment variable configuration.
5. After the JDK program is installed and configured, you can test whether the JDK can be run on the computer by running the "Start" command, in the open "run" dialog box, enter the "cmd" command, and then enter the DOS environment. Enter "javac" directly after the command prompt, and press the <enter> key, the system outputs the help information of javac, indicating that JDK has been successfully configured. Otherwise, you must carefully check whether the configuration in the preceding steps is correct.
Java program development process
Java program development can be divided into three steps:
1. Compile the Java source file. A Java source file is a text file with the extension of. java. (For example, X. Java)
2. Compile the Java source file, that is, compile the Java source file (compile) into a Java class file (the extension is. class), for example, use the export javac.exe command to convert X. compile the Java file into "x. class.
|
The local computer code. Explain and execute. |
3. Run the Java program. Java programs can be divided into Java application and Java applet ). Java application must use the Java interpreter to explain and execute its bytecode file, and Java Applet must run in a browser that supports it (IE browser.