How do I run a Java program from the command line on Windows?

后端 未结 12 1794
广开言路
广开言路 2020-11-22 03:03

I\'m trying to execute a Java program from the command line in Windows. Here is my code:

import java.io.File;
import java.io.FileInputStream;
import java.io.         


        
12条回答
  •  耶瑟儿~
    2020-11-22 03:51

    You can compile any java source using javac in command line ; eg, javac CopyFile.java. To run : java CopyFile. You can also compile all java files using javac *.java as long as they're in the same directory

    If you're having an issue resulting with "could not find or load main class" you may not have jre in your path. Have a look at this question: Could not find or load main class

提交回复
热议问题