Why can’t I make an existing project a Java project in Eclipse?

This is something that always frustrates me with Eclipse, unless you create a project as a Java project there appears to be no way to make it one through the interface. The most common case I have is I check something out of Subversion but can’t compile it because it’s just a regular project.

I should be able to go to Project Properties > Builders and add a Java builder. But it’s not possible. If I choose ‘New’ I can add an Ant Builder or a Program. If I choose ‘Import’ I have to find some configuration file. Why isn’t ‘Java’ in the new list?

The only way I’ve found is to add the following to your .project file then restart Eclipse:

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

Then you can configure the project as a Java one and setup the build path, library dependencies, etc.

Does any one know of an easier way?

Spread the word: Technorati related  |  Technorati related  |  del.icio.us bookmark it!  |  submit Why can’t I make an existing project a Java project in Eclipse? digg.com digg it!  |  reddit reddit!

3 Responses to “Why can’t I make an existing project a Java project in Eclipse?”

  1. Mikkel Heisterberg says:

    I do the same thing although it is also possible to checkout a project into an existing Java project (at least when using CVS) though you have to create an empty project before going to CVS. An easier way would be preferable.

  2. Geoff says:

    In eclipse, 3.2 anyways, open the wizard to create a new Java project.

    Enter the project name on the first page.

    Look down the same wizard page at the Content section. There is an option to “Create project from existing source”.

    use it.

    be happy.

  3. Geoff says:

    of course you have to check out the code outside of the workspace to do this.

    I actually never host the projects in the workspace. I import them.

    Makes upgrading between versions of Eclipse much less painful.

Leave a Reply

Line and paragraph breaks automatic.
XHTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>