bash: jar: command not found bash: jar: command not found bash bash

bash: jar: command not found


Install Java devel as follows:

 yum install java-devel


To be specific, JAVA bin directory is not in your PATH variable. Add it to PATH variable. In order to search the executables, the OS need to have a list of directories to look up. So, Add the directory which contains 'jartool in thePATH` environment variable

Note : For Windows, Path separator is (;) and for Unix-like OS, Path separator is (:)


The "[sshexec]" tells me you are using some Jenkins plugin to execute a command on a remote host.

This usually means Jenkins executes this (or an equivalent thing by implementing the SSH protocol natively):

ssh user@remotehost 'jar arg1 arg2...'

What happens here is the sshd daemon on the remote host will execute the default shell of the user and ask the shell to execute the command line. The shell is typically not executed as a "login shell", meaning the shell will skip the initialization steps that login shells normally do when the user logs in interactively.

You can study man (name of your shell) to see exactly what the difference is between a shell executed with -l option and one executed without it. In the case of bash it essentially means .profile and .bashrc will not be executed, so any PATH modifications you might have there will not take place.

I think your best bet is to provide the full path to the jar command when you want to execute it.