How to resolve the issue of JDK installation not taking effect on CentOS 7

To resolve the issue of JDK not working after installing on CentOS 7, you can try the following steps:

  1. Verify the JDK installation location: First, make sure that the JDK has been successfully installed on CentOS 7 and know the installation location of JDK. By default, JDK is installed in the /usr/java directory.
  2. Set up environment variables by opening the terminal, editing the /etc/profile file, and adding the following content.
export JAVA_HOME=/usr/java/jdk路径
export PATH=$JAVA_HOME/bin:$PATH

Replace the path “/usr/java/jdk” with the actual installation path of JDK.

  1. To apply the environment variables, run the following command to make them take effect immediately:
source /etc/profile
  1. To verify if JDK is working properly: run the following command to check the JDK version number for validation.
java -version

If the JDK version number displays correctly, it means that the JDK has been successfully activated. If it still does not work, you can try reinstalling the JDK or checking other configuration items.

bannerAds