I need to extract the contents of the Jar in to a specific location. When I run the below command to extract jar, it works correctly.
jar -xf location/ex.jar
The same command I placed inside a script(.sh/.ksh). When I run the script, I get the below error:
jar: not found.
Both the user are same from which I run the script/command.
I am using AIX server.
PATH
environment variable is not initialized the same way in your terminal and in your script. Which might be normal actually. First, ensure that you are using the same shell (typeecho $0
in your terminal) and set your script header (for instance#!/bin/bash
). Then, check your environment initialization files and find precise information about their loading order to be sure of what is done with yourPATH
variable. – maxime.bochon Oct 5 '15 at 12:00ksh
is more standard on AIX, but if it's only for launching a Java application, it does not really matter. Use thewhich
command to get the path to the binary. For instance,which ksh
may display/bin/ksh
. – maxime.bochon Oct 7 '15 at 12:30