I have successfully installed Java and used it without any problem. I haven’t moved it for a long time. Recently, I suddenly wanted to use it, but I found that the javac command reported an error bash: Java: command not found. I searched a lot of information on the Internet and reinstalled it five or six times, but it didn’t solve the problem. I suddenly had an inspiration in the morning, tried it, and then solved it. I hereby record it, I hope I can bring help to my friends who encounter the same problems.
Many schemes on the Internet refer to the configuration of environment variables. The author has compared them many times, changed folders in different locations and reinstalled them many times, but he doesn’t think there is a problem with his configuration, CMD — & gt; There is no problem entering Java commands, but javac always reports errors, which is very confused.
Finally, the author found that it was really the problem of environment variable configuration. It was not that the content of the configuration was wrong, but that although he installed it many times, he only changed Java for the configured environment variables for fear of trouble_ The problem has not been solved because of the value of home… Therefore, after uninstalling the Java software, remember to delete the environment variable configuration and reset it when reinstalling to solve the problem.
Attach the configured environment variables:
.;% JAVA_ HOME%\lib\dt.jar;% JAVA_ HOME%\lib\tools.jar;
%JAVA_ HOME%\bin;% JAVA_ HOME%\jre\bin;
1. JAVA_ The value of the home variable is simply the folder where you install the JDK part of the Java software
2. The values of classpath variable and path variable can be used directly
3. The value of classpath variable should be preceded by a “.”
- [Solved] JPype Error: FileNotFoundError: [Errno 2] No such file or directory: ‘/usr/lib/jvm’
- [Solved] NB: JAVA_HOME should point to a JDK not a JRE
- Solution to the problem of not able to find Java executable or version in JMeter installation
- The CATALINA_HOME environment variable is not defined correctly
-  Maven configuration error and the Java_ The solution of home environment variable is not defined correctly
- [Solved] JAVA Run Error: Error: Could not find or load main class
- Sudo starts Tomcat and reports an error. There is no Java environment
- CentOS Error -bash:systemctl:command not found
- Jenkins – mvn: command not found
- Solve the error reported by eclipse project: unbound classpath container