How to run a Java program in cmd command line

cmd run java

There are new Meng asked me how to use cmd to run Java, he runs given up, how to do?
As shown his execution:
Here Insert Picture Description

他说就这一个类,里面包含了main方法怎么会没有加载主类呢。

In fact, very simple, because when you are doing and not be called directly .class, represent direct calls .class run this machine, and you can not run a computer class files, you只能把class文件放进虚拟机里运行,怎么放呢?

Figure:
Here Insert Picture Description
把后缀去掉即可

Guess you like

Origin www.cnblogs.com/blackjoyful/p/11539684.html