This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark ".sh file not found" Watch ".sh file not found" New topic
Author

.sh file not found

Srinivas Ivaturi
Ranch Hand

Joined: Jan 28, 2003
Posts: 50
Hi

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
Marshal

Joined: Mar 22, 2005
Posts: 41137
    
  45
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 );"


Ping & DNS - my free Android networking tools app
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?

Thanks
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.
 
Consider Paul's rocket mass heater.
 
subject: .sh file not found
 
Similar Threads
Regarding accessing environment variables
del command with Runtime.exec()
Process
java.io.IOException: Not enough space
Exception - Running command line from Java