We use the Windows platform as an example to explain in detail how to build a Java development environment.
Step 1: Download JDK1.4
JDK is the abbreviation of Java Developement Kit. 1.4 version is the most stable version, and we strongly recommend you to use. Can be from Sun Java Site
Download JDK1.4.
Step 2: Install JDK1.4
Run JDK1.4 installer, select a installation directory, follow the installation wizard to complete the installation of JDK1.4. For details, please refer to
Java 2 SDK 1.4.2 INSTALLATION Notes for Microsoft WINDOWS.
Step 3: Set environment variables
Setting the environment variable is to make it easier to use JDK development. Some Java programs also rely on environment variables to locate JDK, so we strongly recommend that you set the following environment variables:
Java_Home =
Classpath =.
PATH =
Note: The value of the ClassPath variable is "." (Excluding quotation marks), and finally add ";% java_home% / bin" in the PATH variable (excluding quotation marks).
The ClassLoad of the Java virtual machine searches the Class file according to the path set by the classpath. Please note that ClassLoader does not search in the current directory, users who are used to Windows may be unexpected, and Linux users are very clear. For convenience, we set the classpath "." The current directory is included.
Step 4: Compile a Java program
Please enter the following with any text editor and save it as a Hello.java file (only saved as Hello.java, you can't use other file names):
Public class hello {public static void main (string [] args) {system.out.println ("Hello, World.");}} then open the console, switch to the directory where Hello.java is stored, enter: Javac Hello .java
If compiled, there is no display on the screen. Otherwise, an error message will be output on the screen, please check the source code carefully.
Step 5: Run a Java program
Turn on the console and switch to the directory where Hello.class is stored, then enter: Java Hello
Slow a few seconds, screen output: hello, world.
Explain that the operation is successful!
Precautions:
Java strictly sesers cases, whether it is source code, or file name, directory name, Windows users should pay special attention. Also, don't use Chinese document names and directory names, do not use special characters in the file name or directory name, so as not to run the normal Java program in Linux can't run in Windows.
It is used to the beginning of the uppercase letters, and the method name begins with lowercase letters. Please strictly abide by name habits to avoid can't compile or run normally in some IDEs.