File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

calling Unix script from Java

 
Sandeep Advani
Ranch Hand
Posts: 78
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Scott Dunbar
Ranch Hand
Posts: 245
  • 0
  • Mark post as helpful
  • send pies
  • 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 agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic