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?
- Select project.
- Open the project properties through Project -> Properties.
- Go to "Targetted Runtimes" and add the proper runtime. Click APPLY.
- Go to "Project Facets" and select the JAVA facet which has appeared due to step 4. Click APPLY
- Set your build path.
- 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.