Answers for "how to run java class file in cmd"

1

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

run java class file

// Don't usee .class at the end of class file name
java ClassFileName //--in file path-- if file doesn't have package
java PackageName.ClassFileName //--in package path-- if file have package
Posted by: Guest on May-15-2021
1

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

run java class file

// Don't usee .class at the end of class file name
java ClassFileName //--in file path-- if file doesn't have package
java PackageName.ClassFileName //--in package path-- if file have package
Posted by: Guest on May-15-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language