Jenkins reported an error using Sonar Scanner:

which: no java in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin)
Could not find 'java' executable in JAVA_HOME or PATH.
Copy the code

Solutions:

[root@localhost bin]# which Java /usr/local/java/jdk1.8.0_291/bin/java [root@localhost bin]# ln -s / usr/local/Java/jdk1.8.0 _291 / bin/Java/usr/bin/JavaCopy the code

Create a soft chain to solve the problem!

Ln -s/usr/local/Java/jdk1.8.0 _291 / bin/Java/usr/bin/Java