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

后端 未结 12 1796
广开言路
广开言路 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:40

    Now (with JDK 9 onwards), you can just use java to get that executed. In order to execute "Hello.java" containing the main, one can use: java Hello.java

    You do not need to compile using separately using javac anymore.

提交回复
热议问题