1. Check the JDK installation path and version
1.windows
echo %JAVA_HOME%: View the JDK installation path
java -version: View JDK version
2.linux
echo $JAVA_HOME
echo $PATH
java -version: View JDK version
2. Configure linux environment variables: (remember source .bash_profile)
1. Modify the /etc/profile file (all users globally)
vi this file /etc/profile, add at the end of the profile file:
export JAVA_HOME=/usr/share/jdk1.6.0_20 export PATH=$JAVA_HOME/bin:$PATH export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
2. Modify the .bash_profile file (a user authority uses these environment variables)
Add at the end of the bash_profile file:
export JAVA_HOME=/usr/share/jdk1.6.0_20 export PATH=$JAVA_HOME/bin:$PATH export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
3. The shell terminal executes the following commands: (temporary)
export JAVA_HOME=/usr/share/jdk1.6.0_14 export PATH=$JAVA_HOME/bin:$PATH export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
3. Uninstall jdk
1. Find the _uninst subdirectory of the jdk installation directory
2. Execute the command ./uninstall.sh in the shell terminal to uninstall jdk.
Article source: http://blog.csdn.net/zwhfyy/article/details/8349788