Updated on 2023-11-28 GMT+08:00

Environment Variables Are Not Configured

Symptoms

During the deployment of the Spring Boot startup command in the action Start/Stop Spring Boot, the error message please configure JDK environment variables is displayed.

Cause Analysis

  1. JDK is not installed.
  2. Environment variables are not configured or are incorrectly configured.
  3. When openjdk-1.8.0 is selected for JDK Version in the action Install JDK, JDK environment variables are manually configured and the path is set incorrectly.

Solution

  1. If JDK is not installed, install it through the action Install JDK.
  2. Configure the environment variables correctly.

    The current startup mode is no_login. If the Linux OS is used, you need to manually install JDK and add the JDK environment variables to the following files:

    • Ubuntu: ~/.bashrc and ~/.profile
    • Centos: ~/.bashrc and ~/.bash_profile

    The following is a configuration example of the environment variables:

    • export JAVA_HOME=/usr/local/jdk /jdk1.8.0_151
    • export CLASS_PATH=$JAVA_HOME/lib:$JAVA_HOME/jre/lib
    • export PATH=$JAVA_HOME/bin:$PATH
  3. If the Linux OS is in use and JDK of the version openjdk-1.8.0 is installed using the action Install JDK, you do not need to manually configure JDK. However, you must delete the JDK environment variables from the following files:
    • Ubuntu: ~/.bashrc and ~/.profile
    • Centos: ~/.bashrc and ~/.bash_profile

Starting or Stopping Spring Boot FAQs

more