简体   繁体   中英

Eclipse: The project description file (.project) is missing

My project in eclipse was working all fine until I rebooted my system. On reopening the eclipse IDE, I started getting “Error: Could not find or load main class ...”. In the process to "fix" things, I deleted the .project file as well. (How very naive of me!) Now everything seems to be messed up. I cannot see my files being listed in the "Package Explorer". On opening the project it errors out saying: The project description file (.project) is missing . I still have all the source files and the compiled .class files in the respective directories.

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). 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)

The main() method as I said is there. Its baffling how a project which I have been working on since 5 months with all things were working fine has suddenly become unusable. Could someone provide any insight on the latest error.

Thanks!

  1. Create a Dummy Project
  2. Take the .project file and modify this part

< 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):

<?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.

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

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