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. application nokia rm-243 6120c(b20.01)
  2. wifi no pasward janva ni app
  3. hp 2560p restarts after shutdown
  4. itunes login createSession
  5. day597
  6. JFQS
  7. perfect9pn
  8. grainoh6
  9. dutys4l
  10. improvecqj
Copyrights 2019 Fcffair BigData Resource, All rights reserved