Java First Lesson: configuration of the Java development environment (2012-12-21 21:52:29) reprint: http://blog.sina.com.cn/s/blog_6db312f10101a4kq.html
noun Explanation:Jdk:java Development Kit (Java Development Kit) Jre:java Runtime Environment (Java Runtime) ide:integrated development environment ( Integrated development Environment)to install the program:1. Install the JDK (Development Kit): used to compile and run Java programs. In general, you can use commands to compile and run Java programs under the DOS console interface by configuring environment variables. 2. Install JRE (Java Program Runtime Environment): If the JDK is installed, the JDK will automatically install the JRE (without having to separately download the JRE,JDK installation package is already integrated), but if you just run Java programs instead of development, you only need to install the JRE. 3. Installing Netbeans:netbeans is one of the many Java ides that can in principle write Java programs with any text-capable tool, such as Notepad that comes with Windows systems, but for convenience, the integrated development environment is generally used. NetBeans is one of many integrated development environments that are more suitable for beginners. In addition to NetBeans, there are development tools such as Eclipse,myeclipse,jbuilder. Most Java programmers use Eclipse and Myelclipse,netbeans as a free, integrated development environment developed by Sun, the engineer of Sun, which was originally developed by IBM and later donated to the open source community. MyEclipse was initially just a charging plug-in for Eclipse (for the development of the Java EE platform), then myeclipse simply integrated Eclipse, so now MyEclipse is not just a plugin, eclipse free, MyEclipse fees. Beginners are advised to use Netbeans,netbeans volume is also relatively small.JDK Common tools:The Javac.exe:Java compiler, which compiles Java source programs into bytecode, compiles. java files into a. class file. The Java.exe:Java interpreter, which interprets the execution of Java bytecode, takes a. class file and then starts the Java Virtual Machine (JVM) to interpret and execute. Appletviwer.exe: Used to run and debug Java applets that have been compiled into bytecode. Javadoc.exe:Java Document authoring tools. Jar.exe: Compression tool JAVAH.EXE:C header file generation tool for writing local methods. Jdb.exe:Java debugger, used to debug Java programs. Wsimport: Introducing Web Services.To Configure environment variables:Start configuring environment variables, right-click My Computer---properties-----advanced---environment variables,
Select "New System Variable"--pops up the "New System Variable" dialog box, enter "Java_home" in the "Variable name" text box, enter the installation path of the JDK in the "Variable Value" text box (that is, the folder path of step 5), click the "OK" button,
View the path variable in the system Variables options area, and if it does not exist, create a new variable path, otherwise select the variable, click the Edit button, and add "%java_home%\bin;%java_home%\jre\bin;" At the beginning of the Variable Value text box. or direct "%java_home%\bin;", click the OK button,
View the CLASSPATH variable in the system Variables options area, and if it does not exist, create a new variable classpath, otherwise select the variable, click the Edit button, and add "in the start position of the Variable Value text box."; %java_home%\lib\dt.jar;%java_home%\lib\tools.jar; ". (of which ".; Represents the current directory ")
The configuration of the test environment variable is now successful or not. Enter "JAVAC" in the DOS command line window and the output Help information is configured correctly.
PrecautionsRemember not to miss out on the last ";" Symbol.Run the first Java programThe Java environment is configured so that we can run the first Java program. To facilitate access to the folder with a DOS command, I chose to place the program in the JDK installation directory.
First I create a new folder "Test", and then create a new Notepad file, the command is: Firstjava.java (note the suffix is. java, if you hide the extension, please unhide the extension, if not cancel, please Baidu a bit.) Then use Notepad to open the newly created Firstjava.java, and enter the Java program statement inside://my first Java Programpublic class firstjava{public static void main ( String args[]) {System.out.println ("This is my first Java program!"); }} Save the file. (Note that the class name after class must be the same as the file name.) You can see that my class name and folder are all "Firstjava"). Then click Start-Run (shortcut key win+r), enter "CMD", return to open. Enter "D:" and then enter the D drive (because the Java program you just wrote is in a folder on D drive), enter "dir" to view the contents of the current folder, as shown in.
OK, after several CD and Dir commands, we have entered the folder where I wrote the Java program in the command line interface, the last one, we can see that there is a file named "Firstjava.java", This is the file we created earlier and wrote a few lines of Java programs in it.Now we use Javac to compile. First Use Dir to view the test folder, found only one file, and then enter "Javac Firstjava.java", carriage return, and then use Dir to view the files inside the test folder, found to be two, that is, Just now Javac has generated a Firstjava.class file for Firstjava.java compilation.Note: Javac is a program, a compiler for compiling Java programs.
Execute the Java program below. Above, we have compiled the "Firstjava.java" program source file into a class file using Javac. Enter "Java Firstjava" to execute.
The first Java program executes successfully, OH yes!
Report:several dos common commandsdir: dir is the abbreviation for directory, Chinese means "directory" or "folder", the dir command is used to display files and folders under the current path (like LS under Linux), and then add a folder name to view files and folders under this folder. Cases:dir newfolderCD: CD is the abbreviation for Change directory, which is "changing directory", the CD command is used to change the current path, this is the same as Linux, for example: CD. Indicates a return to the previous level of the directory,CD foldernameRepresents the entry into the folder.Tree: The tree command is used to display the directory trees under the current directory.C: Enter the C drive, the same as D: Enter the D drive, E: Enter the e-disk.
Configuration of the Java development environment