Opening MS-DOS with Java

Advertisement
November 30

I'm involved in a college programming class with Java and I'm stumped. I need to create a Java program that is able to open the MS-DOS prompt window and run a Java program in it as well as add a MS-DOS command afterwards in order to catch the output. Basically I need a program that does the following command:
C:\[pathname]javac [filename].java 2> output.txt
Any help would be greatly appreciated. Thanks guys! :)

Advertisement

Replay

Here's a hint:
public class Test {
    public static void main(String[] args) throws Exception {
        if(args.length == 0) {
            String command = "cmd /c start java Test TEST";
            Runtime.getRuntime().exec(command);
        else {
            System.out.println(args[0]);
            System.out.println("Hit return to exit.");
            System.in.read();
}Good luck.

View 3 Replies

Tags:

  1. migo stock type
  2. mobilink ssl port chacking apps
  3. badi or bte in sap afab transaction
  4. rfbibl00 newko
  5. oracle r12 payable aging report gl date
  6. elitepad 900 shutsdown
  7. does STATUS_CHANGE_EXTERN COMMIT WORK
  8. 3D8Y
  9. UAFT
  10. 09MY
Copyrights 2019 Fcffair BigData Resource, All rights reserved