Hi,
Have you configured that java setup in that particular slave? Have you run the same command manually? Can you add "java -version" command in your sh and check what java version is installed?
On the other hand, Jenkins provide some specific configuration about java, you can configure those jdk versions in the global settings, and set what java version you need to use in your jenkins job:
It might help you
Cheers