Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

.sh file not found

 
Srinivas Ivaturi
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does the command
/data1/eqa/Installdir/ssacrm1408/shared/bin/cljava.sh com.test.profileloader
work from shell?
 
Srinivas Ivaturi
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, it works for me.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic