• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

.sh file not found

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)
 
Rancher
Posts: 43026
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes, it works for me.
 
Put the moon back where you found it! We need it for tides and poetry and stuff. Like this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic