English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Java is a general-purpose computer programming language that is concurrent, class-based, object-oriented, and more. Java applications are usually compiled to run on any Java Virtual Machine (JVM).Bytecode, and is unrelated to computer architecture.
The following is the environment setup for Linux and Windows. JVM, JRE, and JDK all depend on the platform because each operating system's configuration is different. However, Java is platform-independent.
Before setting up the environment, let's first understand the respective uses of the following terms:
JDK(Java Development Kit): JDK is used by software developers and includes development tools such as the Java compiler, Javadoc, Jar, and debugger.
JRE(Java Runtime Environment): JRE includes the Java library components needed to run Java programs and is used by end users. JRE can be considered a subset of JDK.
JVM: JVM (Java Virtual Machine) is an abstract machine. It is a specification that provides a runtime environment in which Java bytecode can be executed. JVM can be used on many hardware and software platforms.
Download JDK (this article is about Java8
Firstly, we need to download the Java Development Kit (JDK), the Aliyun mirror download address is:https://code.aliyun.com/kar/oracle-jdk/raw/3c932f02aa11e79dc39e4a68f5b0483ec1d32abe/jdk-8u251-windows-x64.exe
After downloading, run.exeDownload it, run
Install JDK, you can customize the installation directory and other information during the installation process, for example, we choose the installation directory to be C:\Program Files\Java\jdk1.8.0_251
Go toSpecify panel->System and Security->System.
Under the 'Advanced System Settings' option, click on the Environment variables, as shown below.
In "System variablesSet in " 3 Item attribute, JAVA_HOME, PATH, CLASSPATH (case insensitive), if it already exists, click 'Edit', if it does not exist, click 'New'.
The variable setting parameters are as follows:
Variable name: JAVA_HOME Variable value: C:\Program Files\Java\jdk1.8.0_251 // Configure according to your actual path Variable name: CLASSPATH Variable value: .;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar; //Note that there is a '.' at the beginning Variable name: Path Variable value: %JAVA_HOME%\bin;%JAVA_HOME%\jre\bin;
Click OK, save the settings, and you are done! Now, to check if the installation has been completed correctly, open the command prompt and enterjavac -version. You will see the output information before, indicating that the installation has been completed correctly.
C:\Users\Administrator>javac -version javac 1.8.0_251
To determine if the compiler is installed, enter the following at the command promptjavac. You will see a list related to javac.
There are several ways to install Java on Linux. However, we will introduce the simplest method to install Java using the terminal. For Linux, we will install OpenJDK. OpenJDK is a free and open-source implementation of the Java programming language.
Go toApplication->Attachment->Terminal.
Enter the following command.
sudo apt-get install openjdk-8-jdk
For the 'JAVA_HOME' (environment variable), as shown below, enter the installation path in the 'Terminal' using the command... (Note: The default path is as shown, but if you have installed OpenJDK at another location, please set this path.)
export JAVA_HOME= /usr/lib/jvm/java-8-openjdk
For the 'PATH' (environment variable), enter the command using the installation path in the 'Terminal' as follows... Note: The default path is as shown, but if you have installed OpenJDK in another location, please set this path.)
export PATH=$PATH:/usr/lib/jvm/java-8-openjdk/bin
You are done! Now to check if the installation is completed correctly,PleaseType in the terminaljava -version. You will see Java running on the computer.
Popular Java Editors/ IDE:
Notepad++ / gedit: They are simple text editors used to write Java programs. Notepad++Available on Windows, while gedit is available on Linux.
Eclipse IDE: It is the most widely used IDE (Integrated Development Environment) for developing software with Java. You can downloadHereDownload Eclipse .
IntelliJ IDEA: is an integrated development environment (IDE) developed for the Java programming language.