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.
In recent versions of eclipse the fix is slightly different...
- Right click and select Project Properties
- Select Project Facets
- If necessary, click "Convert to faceted form"
- Select "Java" facet
- Click OK
I deleted the project without removing content. I then created a new Java project from an existing resource. Pointing at my SVN checkout root folder. This worked for me. Although, Chris' way would have been much quicker. That's good to note for future. Thanks!
Using project Project facets we can configure characteristics and requirements for projects.
To find Project facets on eclipse:
- Step 1: Right click on the project and choose
properties
from the menu. Step 2:Select
project facets
option. Click onConvert to faceted form...
Step 3: We can find all available facets you can select and change their settings.