HI, I have a Java program that reads a text file. This file contains a method signature on every line, basically either get or set methods. The program sorts the source file and writes all the get methods into one text file, and the set methods into another text file. Now I want the java program to be able to show the contents of both these files, just as we would type "type get.txt" on the DOS command line. We can write the contents of these files using output streams onto the console, but can we run the DOS commands from the java file itself ? Any suggestions would be welcome. Thanks in advance.
posted 15 years ago
Process P; Runtime rt = Runtime.getRuntime(); P = rt.exec("type get.txt"); One can then use a buffered reader to get the process output if one desires.