How to get a class file by Eclipse?

32,695
  1. Cleaning the project should be enough to start the build. Menu:Project ->Clean
  2. Check that automatic build is enabled. Project -> Build Automatically
  3. If automatic build is disabled use build all. Menu: Project -> Build All
Share:
32,695
Roman
Author by

Roman

Updated on July 09, 2022

Comments

  • Roman
    Roman almost 2 years

    I wrote an application in the Eclipse, which was successfully compiled and run. After that, in a corresponding directory I found *.java and *.class files. Then I have deleted the *.class file and now I do not know how can I get it back.

    Eclipse writes me "A class file was not written. The project may be inconsistent, if so try refreshing this project and building it".

    By the right click on the project I got a drop down menu in which I found "Refresh" but I cannot find out how can I "build" the project.

    So, how can I generate the class file again?

    Thank you in advance for any help.

  • Roman
    Roman over 14 years
    OK. But how can I "clean" the project?
  • Ash
    Ash over 14 years
    If Build Automatically is disabled, the Clean dialog has an option (selected by default) to start a build after the clean anyway (at least in 3.4.x).
  • Roman
    Roman over 14 years
    Ash, in my case the "Build Automatically" is not disabled. Should I disable it? Where can I find the clean dialog? How can I initiate the clean?
  • Roman
    Roman over 14 years
    I found "Clean Up" in the "Source" menu. I clicked it and I did not get the desired *.class file.
  • Thomas Jung
    Thomas Jung over 14 years
    "Clean..." is in the same "Project" menu as "Build Automatically".
  • Roman
    Roman over 14 years
    Thanks, Thomas! Project->Clean worked well. Now I have the class-file.