Visit Our UNIX and Linux User Community

Error running a .sh script when extracted from a jar file.

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Error running a .sh script when extracted from a jar file.
# 1  
Old 01-04-2010
Error running a .sh script when extracted from a jar file.

I am trying to run a script called as follows:

I get a jar file, and extract it using the command:

unzip filename.jar -D path/to/files

then I navigate to that directory where I extracted the files, and run the command:


(where is one of the files that has been extracted in that directory using the above unzip command.)

running this command gives me an error:

' command not found.'

among other errors in the script ( from that portion of the script that should not even be executed, which is really weird).

However, instead of unzipping the jar file, if I just copied the same file to that folder, and ran the 'sh' command, the script runs fine. This makes me think that there is something wrong with unzipping of the jar file, but not sure. I am out of ideas on this. Any help would be appreciated.

P.S. I am using the ksh shell.
# 2  
Old 01-04-2010
Try "sh ./"
# 3  
Old 01-04-2010
I tried that already, that gives the same error.

---------- Post updated at 04:31 PM ---------- Previous update was at 04:03 PM ----------

As I said the script runs fine if I just copied the file and ran that command. It works fine even if I extracted the file from jar, deleted it, and brought it back, and then ran that command ( sh It is only if I run that command directly after extracting it from the jar, do I get the error.
# 4  
Old 01-04-2010
chmod +x
sh ./

# 5  
Old 01-04-2010
Ok. I tried :
chmod +x
sh ./,

and that did not solve the problem.

Here is the listing of ls -l on that directory:
[oracle@vmhealthedb02]$ ls -l
total 20
-rw-r--r--  1 oracle oinstall   99 Dec 29 11:41 determineDataPumpDir.sql
-rwxr-xr-x  1 oracle oinstall 4802 Jan  4 15:18
drwxr-xr-x  2 oracle oinstall 4096 Jan  4 15:19 META-INF
drwxr-xr-x  2 oracle oinstall 4096 Dec 28 14:25 scripts

Last edited by Scott; 01-04-2010 at 07:45 PM.. Reason: Please use code tags
# 6  
Old 01-04-2010
could you please give me the output with below command?

sh -x ./

# 7  
Old 01-04-2010
This is gonna sound silly, but I'm not sure what you're running. You do have /bin/sh right?

Previous Thread | Next Thread
Test Your Knowledge in Computers #794
Difficulty: Medium
1/10 has a finite binary representation.
True or False?

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script to encrypt the xls file using executable jar in Linux SUSE 11.4

Dear Experts, I am an ERP consultant and would like to learn shell script. We are working on Linux SUSE 11.4 and I am very new to shell scripting. We can manually encrypt an excel file using "executable jar" through command prompt by placing the jar file & the file to be encrypted on a physical... (1 Reply)
Discussion started by: nithin226
1 Replies

2. Shell Programming and Scripting

Shell file to run other shell files running jar files

Hi, I am trying to write a shell script that will go to another folder and run the script in that folder. The folder structure is kind of like this: /MainFolder/ |-> | |-> Folder1/ |-----|-> |-----|-> FileToRun1.jar | |-> Folder2/ |-----|-> (3 Replies)
Discussion started by: sleo
3 Replies

3. Shell Programming and Scripting

Store the name of an extracted file to a temp file

What would be the best way to store the name of an extracted file from a tar to a text file? I want to extract one file from a tar and store the name of the extracted file to a temp file. tar -xvf tar_file.tar file_to_be_extracted (1 Reply)
Discussion started by: erin00
1 Replies

4. Shell Programming and Scripting

Running a script in crontab which executes a jar file

Hi, I have a script (.sh file) which has been created through my login. This script executes a jar file. Java is installed through my login and the folder has been given full permission for access. When this script is added by root in crontab, it does not get executed. Could you please... (1 Reply)
Discussion started by: archana.n
1 Replies

5. Shell Programming and Scripting

unrar - get the name of extracted file

If I have a script that is using unrar e file.part1.rar How does the script get the name of the extracted file if I don't know the extension of the file? In my example the name would be file.***, but I wouldn't know the extension. ---------- Post updated at 05:13 PM ---------- Previous... (0 Replies)
Discussion started by: locoroco
0 Replies

6. Shell Programming and Scripting

include file name to extracted files

I've written the script below to merge only .txt files that exist in one directory into one huge .txt file and ignore other files with other extensions. now the result is one huge .txt file with all the contents of other .txt files how can i add a File Name as a comment before each file? ... (12 Replies)
Discussion started by: miss_dodi
12 Replies

7. UNIX for Dummies Questions & Answers

To send an email with the body content extracted from a file

Hi, I have been trying to shoot an email with the email body to be obtained from a file. Can someone please help me with it.. I have been trying to use the MAILX commad for the same. mailx -s "test email" -r < file.txt but it sends the file as an attachment,while i... (3 Replies)
Discussion started by: rohit.shetty84
3 Replies

8. UNIX for Dummies Questions & Answers

jar command not running in Unix

Hi , I am working in Sun SOlaris 9 and trying to extract a particular jar file in my home. I am giving command "jar xv <filename>" But it just hangs and does nothing ? Any pointers why this is happenning ? or how can I see contents of a jar file? Thanks (2 Replies)
Discussion started by: hkapil
2 Replies

9. UNIX for Dummies Questions & Answers

java.lang.System when running jar

Hello, I recieve the following error when trying to run the following command in a ksh. The operating system is AIX5.1. /usr/bin/jar -xvf {filename}.zip Can't find class java.lang.System But when I run it on the command line it unzips the file fine. Does anybody know why this... (2 Replies)
Discussion started by: ctcuser
2 Replies

Featured Tech Videos