How to get a class file by Eclipse?

我们两清 提交于 2019-12-01 19:15:16

问题


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.


回答1:


  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



回答2:


I get this error message when I have an inner class, and the total name of the main class and its inner classes exceeds 128 characters. This happens both on OpenJDK and Sun JDK 6. The solution for me was to shorten the inner class names.



来源:https://stackoverflow.com/questions/2280176/how-to-get-a-class-file-by-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!