JRE (Java Runtime Environment Java Run environment)
including Java virtual machines (JVM Java) and the core class libraries required by Java programs, if you want to run a well-developed Java program, you only need to install the JRE on your computer.
JDK (Java Development Kit Java Development Kit)
The JDK is available to Java developers, which includes Java development tools and the JRE. So with the JDK installed, you don't have to install the JRE separately.
Development tools: Compilation Tools (Javac.exe) packaging Tools (Jar.exe), etc.
In simple terms: Java programs developed using the JDK are delivered to the JRE to run.
Building a Java development environment
Download and installation of JDK download official website http://www.oracle.com
1. Go to the official website and find "Download"
2. Click "Java DOWNLOAD", where (JDK) 7u51 7 is "JDK1.7 version", "U" for "Update", "51" for the central package is the 51st version
3. Download the first need to accept the agreement, click on "Accept License agreement", according to the computer to download the corresponding version.
4. You can change the installation path of the JDK, select the options that need to be installed, and if the JRE is not installed beforehand, it is best to install it all. After installation, the program can be seen in the control Panel, Java applications, open can complete the configuration of java.
Once the configuration is complete, download the editing tool
First,Notepad (Microsoft operating system comes with)
You first need to configure the PATH environment variable, which is the role of the environment variable:
(1) The execution of the program requires the use of external instruction Javac, but the javac instruction can only be written to the bin directory under the directory of the JDK installation, so the program can only write to the bin directory
(2) During the program development process, the source code cannot be written to the JDK installation directory, so the source program needs to be saved to the specified directory in any location (English directory), so you need to make the javac instruction run in any directory
Configuration Method 1:
by configuring the PATH environment variable, the directory in which the javac instruction is located, the bin directory under the JDK installation directory, is configured under the PATH variable to enable the javac instruction to run in any directory
- WIN7,WIN8 System: Right click on desktop computer → select Properties → select advanced system settings → select advanced tab → Click environment variables → system variables below find path→ double-click Path
- XP system: Right click on desktop computer → select Properties → select advanced tab → Click environment variables → system variables below find path→ double-click Path
- Add the Bin directory under the JDK installation directory to the leftmost and add a semicolon
Configuration Method 2:
How to configure the PATH environment variable in reference form
- Create a new variable name: Java_home
- Add variable values for Java_home: JDK installation directory
- Modify the JDK directory in the PATH environment variable
- %java_home%\bin;
PATH environment variable has precedence
In the command-line mode, if "JAVAC" appears, the configuration succeeds.
Example: writing and running of the first HelloWorld
1. Create a new Notepad in a directory named "Helloworld.java" with the extension ". Java". Open with Notepad and define a class.
class HelloWorld
{
public static void main(String [] args)
{
System.out.println(“Hello World”);
}
}
2. In the command line mode, enter the Javac command to compile the source code and generate the bytecode file.
Open a command prompt. Change the directory to the Java directory. The CD command changes the current directory.
javac source file name. java
3. After the compilation is complete, if there is no error message, enter the Java command to interpret the class bytecode file to run, do not need to add the. class extension
Second, Eclipse
Eclipse is an open-source, Java-based, extensible development platform. For its part, it is just a framework and a set of services for building a development environment through plug-in components. Fortunately, Eclipse comes with a standard set of plugins, including Java development tools (Java Development kit,jdk).
Official website Download http://www.eclipse.org/downloads/
1. Open the Eclipse website and click on the top right corner to download.
2. Select Eclipse IDE for Java EE developers to download and install
Write Java programs in Notepad and Eclipse