How to change an Eclipse default project into a Java project

Open the .project file and add java nature and builders.

<projectDescription>
    <buildSpec>
        <buildCommand>
            <name>org.eclipse.jdt.core.javabuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.eclipse.jdt.core.javanature</nature>
    </natures>
</projectDescription>

And in .classpath, reference the Java libs:

<classpath>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
</classpath>

Manually changing XML and/or settings is very dangerous in eclipse unless you know exactly what you're doing. In the other case you might end up finding your complete project is screwed. Taking a backup is very recommended!

How to do it just using Eclipse?

  1. Select project.
  2. Open the project properties through Project -> Properties.
  3. Go to "Targetted Runtimes" and add the proper runtime. Click APPLY.
  4. Go to "Project Facets" and select the JAVA facet which has appeared due to step 4. Click APPLY
  5. Set your build path.
  6. If it's a Maven project, you might want to select the project, click Maven -> Update Project configuration...

That did it for me. And Eclipse is configured correctly. Hope it'll work for you too.

Tags:

Java

Eclipse