-2

I have some doubts regarding the files .classpath and .project. I'm using eclipse IDE. I created a project. In that project is see that two files are created. They are

  1. .classpath
  2. .project.

Following questions I have:

  1. Can I know what are the main differences between these two files(.classpath & .project)?
  2. What is the main purpose of .project file?
  3. Can i use .project file in place of .classpath file?
  4. Whether .project file is created in all java IDE's?

Any help is highly appreciated

Santhosh
  • 8,181
  • 4
  • 29
  • 56
Vijay Reddy
  • 125
  • 2
  • 14

1 Answers1

1

Most Java IDEs have their own method of storing metadata they need to assist you with your project. Eclipse uses the files you mention. IDEA uses a different file (or a directory if you choose that option).

You generally shouldn't edit these files directly unless you are trying to do something tricky - they are really there for the IDE, not for you, and are not required if you compile your project using an external tool such as javac, ant or maven.

As @geoand mentioned, these files are usually not added to source control as they generally relate to configuration specific to your machine (such as directory structure, etc) and they can be regenerated if required.

Jason
  • 11,744
  • 3
  • 42
  • 46
  • You should probably add to your answer that it is not good practice to add these files to version control :) – geoand May 05 '14 at 06:41
  • if by mistake i have deleted .project file. How can i regenerate it? – Sargam Modak Aug 16 '16 at 09:13
  • I am not very familiar with Eclipse, but I imagine there should be a way to either re-import or create a project from existing sources. – Jason Aug 16 '16 at 22:23