How can I change the JDK environment variable in Linux and make it take effect?
To modify the JDK environment variables on Linux and make them effective, you can follow these steps:
- Open the terminal window.
- Open the ~/.bashrc file using a text editor like vi or nano.
vi ~/.bashrc
- the JDK located in /usr/local
export JAVA_HOME=/usr/local/jdk
export PATH=$JAVA_HOME/bin:$PATH
- Save the file and close the text editor.
- Execute the following command to make the modified environment variables take effect:
source ~/.bashrc
The JDK environment variable has now been modified and is effective. You can input the java -version command in the terminal window to verify if the JDK has been correctly installed and the environment variable has been set.