Install JDK8 Offline Linux: Guide
To install JDK 8 offline on a Linux system and configure environment variables, you can follow the steps below:
- Download the JDK 8 installation package: Firstly, download the JDK 8 installation package from the Oracle official website, choose the installation package that corresponds to your Linux system architecture (such as .tar.gz format).
- Unzip the installation package: Move the downloaded installation package to the target installation path (such as /usr/local/java/) and unzip it using the following command:
tar -zxvf jdk-8uXXX-linux-x64.tar.gz
- To set up environment variables, edit the system environment variable configuration file and add the following content at the end of the /etc/profile file (assuming JDK is installed in the path /usr/local/java/jdk1.8.0_XXX):
export JAVA_HOME=/usr/local/java/jdk1.8.0_XXX
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
- Activate system environment variables: Run the following command to make the configured environment variables take effect:
source /etc/profile
- Verify Installation: Run the following command to check if the JDK has been successfully installed and if the environment variables have been configured properly:
java -version
If the JDK version information is displayed, it means the installation was successful and the environment variables have been configured.