Jdk:java develpment Kit-java Development Kit
Jre:java Runtime Environment-java Operating environment
Jvm:java Virtual Machine-java VM
Jdk=jre+java Development Tools (Java.exe, Javac.exe ... )
In a nutshell: Java programs developed with the JDK are delivered to the JRE to run
There are two ways to install a JDK:
1, directly copy folder or compressed package;
2, directly run Jdk.exe, actually Jdk.exe contains two compressed package, one is JDK (this JDK contains JRE), one is the JRE, the installation process is the process of decompression, to the end will be prompted to install the JRE, at this time can choose to refuse;
The unpacked JDK directory can be obtained at any step in the first two steps, and the installation of the JDK will be completed by adding the following variables to the system variables:
Java_home=d:\java\jdk1.8.0_60_x64
Classpath=.; %java_home%\lib\dt.jar;%java_home%\lib\tools.jar
Path=%java_home%\bin;
Here, by the way, the difference between classpath and path:
Path is the system path, add the path of an executable file to the path, then you can execute the executable file under any path, or you can execute the executable file under the join path anywhere.
Classpath, like path, has the path to the. class file, so that you can then execute the. class file in any directory, or you can execute the. class file in any of the joined paths anywhere.
The classpath in the top of the jar file, because the jar file is full of. class files that belong to some class libraries that are dependent on the JDK, and are then called by others, so put them in classpath.
Then I'll write a HelloWorld myself.
Public class helloworld{ publicstaticvoid main (string[] args) { System.out.println ("HelloWorld");} }
Note:the name of the Java file must match the name of the class!
One of the JAVAP is anti-compilation, you can also automatically add a constructor, as to what is specific, you can view the Help or Baidu.
The main method is a special method, which is the entrance to the execution of the program, and a Java program executes from the main method. The Java Virtual machine allocates a main thread prior to executing the Java program, then executes the main method in the main thread, and all the main methods are called the main thread.
More detailed Main method, you can refer to: http://lavasoft.blog.51cto.com/62575/53263/
Start with Java and write Hello World statements