• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

calling Unix script from Java

 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Code snippet is -



I get this exception...

Start compiling ....
Command is source CompileAgent.sh TestClient
Check point 1
Caught an IO exception
java.io.IOException: java.io.IOException: source: not found
at java.lang.UNIXProcess.<init>(UNIXProcess.java:143)
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)
at CompileJava.doWork(CompileJava.java:19)
at CompileJava.main(CompileJava.java:50)
Exception in thread "main" java.lang.NullPointerException
at CompileJava.doWork(CompileJava.java:41)
at CompileJava.main(CompileJava.java:50)

Says source not found but the command runs well when I run this from
the shell prompt.

Thanks again
Sandeep
 
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"source" is a C-shell command (ok, maybe other shells that I'm not familiar with too). Under Unix Java will call the native fork()/exec() of the platform. Under Solaris this is "/bin/sh". Under Linux I think it is "/bin/ksh" but don't hold me to that. Therefore, you will want to do something like:

 
I knew that guy would be trouble! Thanks tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic