Windows XP JDK configuration

  
Java runtime environment installation and testing and HelloWorld implementation. 1. Download j2sdk 1.4.1 or higher (http://java.sun.com, it is recommended to download its Java Documentation at the same time, this is the Java help documentation) 2. Run the just downloaded j2sdk-1_4_1_02-Windows-i586.exe The file is officially installed (the following assumption is installed in c:\\j2sdk1.4.1, it is recommended that the installation path not have spaces, it should not be installed in the \\Program Files directory!). 3. Set the operating environment parameters: a. If it is Win95/98, add the following 3 lines at the end of \\autoexec.bat: set Java_HOME=c:\\j2sdk1.4.1 set PATH=%Java_HOME%\\bin;%PATH% Set CLASSPATH=.;%Java_HOME%\\lib Note:---Open the Notepad with the DOS command notepad c:\\autoexec.bat and add the above 3 lines. b. If it is Win2000, xp uses the mouse to right click on "My Computer" -> Properties -> Advanced -> Environment Variable System Variable -> New -> Variable Name: Java_HOME Variable Value: c:\\j2sdk1. 4.1 System Variables -> New -> Variable Name: CLASSPATH Variable Value: .; %Java_HOME%\\lib System Variable -> Edit -> Variable Name: Path Add the first value of the variable value: %Java_HOME%\\ Bin; (The CLASSPATH has a period "." followed by a semicolon to indicate the meaning of the current path) 4. Use a text editor (eg: edit.com/Notepad/UltraEdit/EditPlus) to write the following code and save it as a file :HelloWorld.java (must be case-sensitive! Assume c:\\test\\HelloWorld.Java) /* HelloWorld.Java */public class HelloWorld { public static void main(String arg[]) { System.out.println(" Hello, World!"); } } 5. Open a DOS window, CD (that is, jump /Change Directory) to the directory where HelloWorld.Java is located c:\\> Cd \\test c:\\test>_ 6. Compile HelloWorld.Java as HelloWorld.class c:\\test>javac HelloWorld.Java 7. Run HelloWorld.class c:\\test>Java HelloWorld Hello, World! c:\\test> _ Note: -------- If there is an error such as Exception in thread "main" java.lang.NoClassDefFoundError:helloworld/javaerror:ccan'n read:HelloWorld.Java, then write javac and Java Inverted. --------- If the Bad command or file name appears, the Javac command does not work, you need: c:\\>set path="c:\\jdk\\bin" Use this command to register the commands in the BIN directory. --------- Also pay attention to capitalization.
Copyright © Windows knowledge All Rights Reserved