posted 20 years ago
Well, I don't see a class named deltrdlck here, and I also don't see how this program could throw a NullPointerException, and nothing prints "Error in command", so I suspect you're not showing us the actual code. Second, note that the "$" character demarcates shell variables, and it's exceedingly unlikely that you've got an actual binary whose name starts with a "$" -- Java isn't going to expand your shell variables for you, you'll need to use the actual name of the program!
Finally, as far as redirects go: Java is a cross-platform language, so you can't expect Runtime.exec() to understand the UNIX-specific concepts of output redirection. If you need to do this, then you can execute an instance of the shell, and tell the shell to do it -- i.e.,
Finally, note that in the command you're running, you're trying to redirect the output to a file. But then in your Java code, you're trying to read the output from the program. If the redirection succeeds, then there will be no output, right? You may need to sit and think a moment about what you actually want to do here.