简体   繁体   中英

Why is it possible to run a java project but only the Main.class file?

I use Netbeans to code java. And I have downloaded a java project on the net and found that in the source package there is only one file Main.class but when I press F6 to run, the project is still running. I wonder why the project can still run without any .java files.

在此处输入图像描述

typically,

  1. you need a xx.java file(with main method in it)
  2. compile it javac xx.java(.class file get generated)
  3. run it with java xx(only using the .class file)

it will run if there is only the .class

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM