Answers for "how to run my java program in cmd"

5

java run cmd

public void excCommand(String new_dir){
    Runtime rt = Runtime.getRuntime();
    try {
        rt.exec(new String[]{"cmd.exe","/c","start"});

    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
Posted by: Guest on July-05-2021
0

How to run java in cmd

// i have a file name : demo.java
public class demo{
  public static void main(String[]args){
    System.out.println("hello world");
  }
}
//open cmd or terminal on folder and then : java demo.java
Posted by: Guest on May-15-2022
-2

how run a code to the cmd from a java code

java cmd
Posted by: Guest on October-21-2021

Code answers related to "how to run my java program in cmd"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language