Download and configure environment variables for JDK
Write a Hello World applet
First, JDK download and installation
JDK:JDK is available to Java developers, and includes Java development tools and 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.
JRE: Includes Java virtual machines (JVM Java) and the core class libraries required by Java programs, and so on, if you want to run a well-developed Java program, you only need to install the JRE on your computer.
1., Download the JDK
Download URL: Https:www.oracle.com/sun
Download the JDK for your computer type
2. Installing the JDK
After the download, double-click the direct installation, the JDK installed in their designated location (not recommended to install on the C-drive), followed by a fool installation, it is OK.
3. Configure Environment variables
Two ways (1) computer, right-click Properties, advanced system settings, environment variables, system variables
Place the installation directory path of the JDK in the system variable PATH environment variable.
Disadvantage: JDK version upgrade, need to change, may cause the path variable to have the operation of mistakenly deleted.
(2) Create a new variable (java-home) in the system variable
Variable Value: JDK installation directory
Add the following variable at the end of the variable value for the existing system variable path:%java-home%\bin;
4, the JDK installation directory structure:
|-bin
All executable files that are suffix. exe
|-DB
For some core jar packages (databases) in the development kit
|-include
Suffix file ending with. h, c file
The |-JRE:JDK contains the Java Operating environment--->JRE contains the JVM
|-lib:
Stores a number of core class libraries
|-src.zip -java源码在这里查看二、编写hello world小程序1、首先在jdk安装目录bin下建一个文件名为:HelloWorld.text(注意打开文件扩展名)![](http://i2.51cto.com/images/blog/201803/29/3f4f74d4b605db4300e326ae6446fd0d.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)2、打开文本进行编写:class 类名{ 主程序:可以被jvm
Fixed format:
public static void Main (string[] args) {
Output statements for Java
System.out.println ("Hello World");
} (Note that beginners are best to set the same class name and file name)
After writing, change this file name extension from. txt to. java.
3. Compiling source files
(1) Enter the DOS environment. Click Start, enter CMD in the run and enter the DOS environment.
(2) in the command line mode, go to the directory where the program is F:/develop, execute javac helloworld.java command, compile the program, the compilation will appear Helloworld.class file, and then continue in the DOS Environment using Java commands, enter Java HelloWorld, you can execute the program, and then output "Hello World".
Basic Java Courses