How to set the JAVA_HOME environment variable in Ubuntu and Raspbian.
Because the configuration of Raspbian is similar to Ubuntu, how to configure it.
First, you can try echo $JAVA_HOME to check whether the environment variables in the system are configured.
If there is no output, there is no configuration.
Use the following command to edit environment variables.
sudo nano /etc/environment
Enter the following at the end of the configuration file:
JAVA_HOME="/usr/lib/jvm/default-java/"
If you don't know what the JDK version you installed and what the path is, please refer to the following article: How to check the installed JDK in Ubuntu.
After saving and exiting, run the command:
source /etc/environment
The purpose of this command is to apply the modified configuration to the current user.
Then run the echo $JAVA_HOME command, you can see that the current JAVA_HOME environment variable has been configured successfully.
https://www.cwiki.us/questions/57938481
Recommended Posts