views:

740

answers:

4

This problem has been frustrating me for some time...

A lot of sites like Sourceforge use SVN or Subversion to manage their code. I have little problem compiling SVN code in C++, but when it comes to Java, my IDE gives me a headache.

I've installed Subclipse for SVN support for Eclipse, and it works. I can check out any code into my Workspace. Now Subclipse will put the whole thing into a special project of some sort that can't be compiled. So I search Google for something and I come up with modifying the eclipse XML file to specify the 'nature' to be a Java project.

Okay, now it's a Java project. Say I have a folder structure like:

\src
\data
\graphics

I get 800 compiler errors complaining the package name is org.company.SomePackage instead of src.org.company.SomePackage.

Then what I do is create packages called src, data, graphics, etc, instead of just folders. I cut and paste everything in the folders into the packages and finally I can compile it.

What is a better way to do this?

EDIT: I can only check out anything SVN as a SVN project, and there's no way within Eclipse to change that to a Java project. How can I check out the SVN as a java project in the first place?

+4  A: 

I get 800 compiler errors complaining the package name is org.company.SomePackage instead of src.org.company.SomePackage.

Right click on Project -> Properties -> Java Build Path -> Source Tab -> Add "src" as a source folder and remove any others.

Kevin
A: 

You have to configure proper source paths. Some open source projects make this automatic by checking their .project and .classpath files in with the rest of their files. For others, you'll have exactly the problem you are having. You need to set the classpath so the Java compiler knows where to find the source. You right click on the project and select properties and configure an arbitrary classpath, but the answer given by Kevin is easier for a beginner.

Eddie
A: 

New Project ... SVN Checkout Projects from SVN

Next>

(create or choose repository location) Next>

Select Folder

Next>

Check Out As

This is the important part, choose:

Check out as a project configured using New Project Wizzard

Finish

Select a wizzard

Choose Java Project

Next>

Then choose a project name

Finish

Clint
This doesn't answer the question, which is the same mistake I made at first.
Eddie
A: 

it thinks your source is stored in root folder. you need to specify to the project that /src is the source folder.

shsteimer