In Eclipse, regular project can be converted to Java project by editing the .project file as follows.
<buildSpec> <buildCommand> <name>org.eclipse.jdt.core.javabuilder</name> </buildCommand> </buildSpec> <natures> <nature>org.eclipse.jdt.core.javanature</nature> </natures>
A cleaner way
* Delete existing project without deleting existing files.
* Create new Java project from existing source.