jQuery in Action, 3rd edition
The moose likes I/O and Streams and the fly likes .sh file not found Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark ".sh file not found" Watch ".sh file not found" New topic

.sh file not found

Srinivas Ivaturi
Ranch Hand

Joined: Jan 28, 2003
Posts: 50

I am trying to execute a .sh file using Runtime.getRunTime() as below. It says that file is not found. But the file exisits in the path. Here is the code snippet I am using. The environment is any non windows environment I am getting this execption.

Process process = Runtime.getRuntime().exec("/data1/eqa/Installdir/ssacrm1408/shared/bin/cljava.sh" com.test.profileloader );

Exception is :

err, java.io.IOException: "/data1/eqa/Installdir/ssacrm1408/shared/bin/cljava.sh": not found
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:84)
at java.lang.Runtime.execInternal(Native Method)
at java.lang.Runtime.exec(Runtime.java:566)
at java.lang.Runtime.exec(Runtime.java:428)
at java.lang.Runtime.exec(Runtime.java:364)
at java.lang.Runtime.exec(Runtime.java:326)
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42958
FileNotFoundException is also thrown in other circumstances, e.g. if the process does not have permission to read the file.

Are you sure that the command you're exectuing is syntactically correct? This looks strange (not like proper Java code):

("/data1/eqa/Installdir/ssacrm1408/shared/bin/cljava.sh" com.test.profileloader );"
Srinivas Ivaturi
Ranch Hand

Joined: Jan 28, 2003
Posts: 50
All permissions are there for that file. I mistyped the command.
Process process = Runtime.getRuntime().exec("/data1/eqa/Installdir/ssacrm1408/shared/bin/cljava.sh com.test.profileloader" );

Is there any other problem that you see?

Srinivas Ivaturi
Vlado Zajac
Ranch Hand

Joined: Aug 03, 2004
Posts: 245
Does the command
/data1/eqa/Installdir/ssacrm1408/shared/bin/cljava.sh com.test.profileloader
work from shell?
Srinivas Ivaturi
Ranch Hand

Joined: Jan 28, 2003
Posts: 50
yes, it works for me.
Have you checked out Aspose?
subject: .sh file not found
It's not a secret anymore!