Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bash: jar: command not found

Tags:

java

bash

jenkins

I'm using Jenkins to deploy the build.

We need to extract files from a .war into some directory. We have an .xml file which includes commands to extract the files from the .war file and start the server.

The build is being created properly but the .war extraction is not happening and the destination folder is being left empty. The Jenkins Console shows the following output:

[sshexec] bash: jar: command not found

As read from other answers, I have set the PATH properly in .bashrc or in .profile but I'm still facing the same issue.

like image 696
Satish Avatar asked May 08 '14 10:05

Satish


People also ask

Where is jar command located?

The executable file of this tool can be located under the JDK_HOME\bin directory (jar.exe on Windows), so make sure you include this path in the PATH environment variable in order to run this tool anywhere from the command line prompt.

Where is jar installed on Linux?

IF you are using the packing system, then a good choice is indeed /usr/share/java/ or /usr/lib (if your app is called from /usr/bin or /usr/sbin). Another good choice would be inside /usr/local, only if this app of yours is host specific.


2 Answers

Install Java devel as follows:

 yum install java-devel
like image 117
Smartop Avatar answered Sep 19 '22 18:09

Smartop


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 (:)

like image 45
Keerthivasan Avatar answered Sep 23 '22 18:09

Keerthivasan