aspose file tools*
The moose likes Java in General and the fly likes Help needed with in executing a UNIX script from Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Help needed with in executing a UNIX script from Java" Watch "Help needed with in executing a UNIX script from Java" New topic
Author

Help needed with in executing a UNIX script from Java

Hari Srinivas
Ranch Hand

Joined: Mar 26, 2008
Posts: 46
Hi All,

i need to run a script in unix from my Java code (as a part of a larger project). I am doing the following



However it doesn't always execute the script( Actually the script in this case generates some files which my program reads later on). Because the files are not always generated, I get a file not found exception later on. (However executing the script as a standalone works). I need some help to understand why this is happening. Thanks a lot in advance
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39396
    
  28
Moving to "general" forum because this is too difficult for "beginning Java".

Make sure to find the classic paper by Michael Daconta before you even think of using Runtime.exec. You should find it from this search: when Runtime.exec() won't.
Hari Srinivas
Ranch Hand

Joined: Mar 26, 2008
Posts: 46
Thank you very much Mr Campbell Ritchie for the reply. Is there any other way of invoking such a script then using Java??? I would be grateful if you could let me know of this as I need to this and this assignment is due shortly.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help needed with in executing a UNIX script from Java