Tag Archives: Development stepping pit

Nacos boot error, unable to find Java_HOME [How to Solve]

Environment: centos7.3, JDK 8, Nacos 2.0.3.

Use the systemctl start Nacos command to start and report an error. The error information is as follows.

Use the java - version command to check that the Java environment variable is effective. You can use the Java command to eliminate the problem of environment variable configuration.

The problem should be in the Nacos startup script. The specific configuration file is shown in the figure below.

The configuration in the red box is a new line I added, that is, I manually specified the JDK used by Nacos to run, and the original detection Java of Nacos_ The configuration of home cannot get Java correctly_Home information, so it’s good to specify it manually. Add Java in the startup. Sh file_ Change the home variable to your local JDK installation location, then save and exit, and restart the Nacos service.

Use the systemctl start Nacos command to restart the service successfully. Use the systemctl status Nacos command to check that Nacos is running normally. The problem is solved.