Sgt. John Seifert

+ Follow
since Nov 13, 2001
Merit badge: grant badges
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Sgt. John Seifert

the path can be found at a unix prompt by typing
which basename
which <whatever you are trying to find.>
21 years ago
actually I solved the problem.
for the benifit of others,
the solution i came up with was to specify the full path to the script variables that it could not find.
for example: it could not find 'basename'
so in my script i replaced 'basename' with 'usr/bin/basename'
what happens is that sometimes the environment is not loaded as it should be so paths to these special reserved functions can not be found, therefore specifying the full path will correct the problem.
hope this can help others, this one was a real pain
21 years ago
i am having a similiar problem and was wondering if you got this to work.
21 years ago
I am having trouble executing the following shell script using Runtime.exec()
. /sideshow/environment/
cd ${ROOT}
print "Send the command '"$*"' to the inbox"
echo $* >> $COMMAND_FILE
uuencode $COMMAND_FILE `basename $COMMAND_FILE` | mailx <target email address>
The syntax I use for Runtime.exec is :
String cmd[] =
Process p = Runtime.getRuntime().exec (cmd);
try { p.waitFor(); } catch (Exception e) {e.printStackTrace();}
The error I am recieving from the output is:
<code>[2]: basename: not found.[21]: rm: not found.[26]: basename: not found.[26]: mailx: not found.[26]: uuencode: not found.
This script work fine from a UNIX command line but doesn't work using Runtime.exec(). Any help is greatly appreciated.
21 years ago
actually i put the <code>open()</code> call in write because i was having a problem with the stream closing. it was sort of a work around to the already existing problem. Typically i would write a 1000 or so lines to a file without closing or re-opening the stream.
21 years ago
Hi all,
I am having problems with the class defined below. The output stream is being closed with out me closing it. It happens when I go to write something out. I have now added code to open the stream before I write even if the stream is thought to be open and it still is closed sometimes. Here is the class below. Any help is greatly appreciated.
public class FileOutputWriter
// The PrintWriter for writing to text files
private BufferedWriter bufferedWriter = null;
private FileWriter fileWriter = null;
// The OutputState of this object
private OutputWriterState state = null;
PrintWriter out = null;
boolean streamIsOpen = false;
String outputTarget = null;
public FileOutputWriter(String outputTarget)
this.outputTarget = outputTarget;

synchronized public boolean open()
throws IOException
boolean append = false;
// Check the state of this object
if (!state.equals(OutputWriterState.NEW))
append = true;

File fout = new File (outputTarget);

= new FileWriter (fout.getAbsolutePath(), append);
bufferedWriter = new BufferedWriter (fileWriter);
out = new PrintWriter (bufferedWriter);
streamIsOpen = true;
return true;
synchronized public void close()
throws IOException
streamIsOpen = false;

synchronized public boolean write(String rec)
throws IOException
out.print (rec);
out.flush (rec);
} // class
Please help. This is driving me nuts!
21 years ago