tags:

views:

67

answers:

3

Hi all,

I am currently studying at university and based on other peoples recommendations I am beginnning to read other peoples code.

i have found and downloaded the source for an open source java project, that seems quite interesting. I want to load this project into an IDE (netbeans or eclipse), so as to make it easier to read and navigate. However both IDE's say that the project is not recognised. It is not only this project, but any project I have attempted to load.

How do I load a project (ie. a file structure of source files) into the above IDE's as a project.

Thanks in advance, Sam

+6  A: 

In Eclipse, select File, New, Java Project, give the project a name and then select Create Project from Existing Source. You should then select the src folder that contains the code that you'd like to use.

Eclipse should then create a new project containing the source. To change the project settings e.g. source folders/external jars, right click on the project in the Package Explorer and select Properties, Java Build Path, Source and make any appropriate changes.

pjp
brilliant, thanks
smauel
A: 

Actually there is a cool trick with Eclipse, you should be able to just select the class that you are interested (select all of the text from your browser), and just paste this in Eclipse right on top of a project, it will automatically create a class for you. It's very handy when working with SWT snippets for example.

You need to have created an Eclipse project first. But you can just create one project and put any number of classes in it.

Francis Upton
A: 

If the open source project in question uses Maven as the build system (i.e., there is a pom.xml file in the root of the project) and you have Maven installed, you can run 'mvn eclipse:eclipse' to build the project files for eclipse to use. Then just use File > Import and select existing project into Workspace and point it at the root of the project folder. Eclipse should then import the entire project with the appropriate libraries. There are also plugins that work for NetBeans and Idea I believe.