Eclipse won't compile/run java file

后端 未结 5 466
忘掉有多难
忘掉有多难 2021-01-01 12:15

I am just trying to compile and run a simple java program. When I go to run my tester class it says select what to run and it gives me Ant Build which when highlighted says

5条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-01 12:56

    • Make a project to put the files in.
      • File -> New -> Java Project
      • Make note of where that project was created (where your "workspace" is)
    • Move your java files into the src folder which is immediately inside the project's folder.
      • Find the project INSIDE Eclipse's Package Explorer (Window -> Show View -> Package Explorer)
      • Double-click on the project, then double-click on the 'src' folder, and finally double-click on one of the java files inside the 'src' folder (they should look familiar!)
    • Now you can run the files as expected.

    Note the hollow 'J' in the image. That indicates that the file is not part of a project.

    Hollow J means it is not part of a project

提交回复
热议问题