简体   繁体   English

Eclipse:缺少项目描述文件(.project)

[英]Eclipse: The project description file (.project) is missing

My project in eclipse was working all fine until I rebooted my system. 我在eclipse中的项目工作正常,直到我重新启动系统。 On reopening the eclipse IDE, I started getting “Error: Could not find or load main class ...”. 在重新打开eclipse IDE时,我开始收到“错误:无法找到或加载主类......”。 In the process to "fix" things, I deleted the .project file as well. 在“修复”过程中,我也删除了.project文件。 (How very naive of me!) Now everything seems to be messed up. (我多么天真!)现在一切都搞砸了。 I cannot see my files being listed in the "Package Explorer". 我看不到我的文件列在“Package Explorer”中。 On opening the project it errors out saying: The project description file (.project) is missing . 在打开项目时,它出错了: 项目描述文件(.project)缺失 I still have all the source files and the compiled .class files in the respective directories. 我仍然在相应的目录中拥有所有源文件和已编译的.class文件。

Please help me out. 请帮帮我。 Appreciate your suggestions. 感谢您的建议。

Thank you! 谢谢!

I followed one of the suggestions (that of copying the .project file and modifying the project name). 我遵循了一个建议(复制.project文件和修改项目名称)。 This brought back me to the stage where I could see all my files in the project explorer. 这让我回到了可以在项目浏览器中查看所有文件的阶段。 But now on running the project from Eclipse, it is not able to find the Main method in the the java file (which actually contains the main()), and errors out as: Error: Main method not found in class , please define the main method as: public static void main(String[] args) 但是现在从Eclipse运行项目时,它无法在java文件中找到Main方法( 实际上包含main()),并且错误输出为: 错误:在类中找不到主方法,请定义main方法为:public static void main(String [] args)

The main() method as I said is there. 我说的main()方法就在那里。 Its baffling how a project which I have been working on since 5 months with all things were working fine has suddenly become unusable. 令人费解的是,自从5个月以来我一直在努力工作的项目如何正常工作突然变得无法使用。 Could someone provide any insight on the latest error. 有人可以提供有关最新错误的任何见解。

Thanks! 谢谢!

  1. Create a Dummy Project 创建一个虚拟项目
  2. Take the .project file and modify this part 获取.project文件并修改此部分

< name > PROJECT_NAME < / name > <name> PROJECT_NAME </ name>

  1. Place this in your old project 把它放在你的旧项目中

Perhaps you could just create another one with something along the lines of this (saving it as .project in the project's directory): 也许您可以创建另一个与此类似的东西(将其保存为项目目录中的.project):

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
    <name>Project Name</name>
    <comment></comment>
    <projects>
    </projects>
    <buildSpec>
        <buildCommand>
            <name>org.eclipse.jdt.core.javabuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.eclipse.jdt.core.javanature</nature>
    </natures>
</projectDescription>

Try the following: 请尝试以下方法:

Make a new project in eclipse (best the same project type as the other ist), when it's created copy the new project file into the old project and edit it manually, it shouldn't be too hard or too much to edit. 在eclipse中创建一个新项目(最好与其他项目相同的项目类型),当它创建时将新项目文件复制到旧项目并手动编辑,编辑时不应太难或太多。

I had the same issue which was due to the project was from an external drive which needed authentication. 我有同样的问题,这是由于该项目来自需要身份验证的外部驱动器。
- Entered the password for the external drive in file explorer - 在文件资源管理器中输入外部驱动器的密码
- Restarted eclipse - 重启日食

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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