Using Eclipse to Create Projects from Existing Source

Hello,

I am new to Eclipse and have been having a really hard time trying to create a project from an existing source. I read through answers to similar questions but nothing has worked for me so far. Thank you in advance for taking a look at my problem and I apologize if the matter's trivial.


I am trying to create a project from the source code contained in the folder:

C:\Users\Babylon\Documents\BNs\JavaBayes\JavaBayes-0.346\Source\BayesianNetworks

However, BayesianNetworks is only one of the folders I am interested in. The complete package/folder structure is attached in the first image (e.g. InterchangFormat, JavaBayesInterface, etc...). All the packages (given as subdirectories of Source) import the packages they require.

Now, to create a new project from BayesianNetworks, this is what I did:

1- Set my workspace as:
C:\Users\Babylon\Documents\BNs\JavaBayes\JavaBayes-0.346\Source

2- File - New - Java Project. In the dialog box, I entered BayesianNetworks for project name and selected the radiobutton for creating a project from existing source with the following source specified:

C:\Users\Babylon\Documents\BNs\JavaBayes\JavaBayes-0.346\Source\BayesianNetworks

This is given in the second image attached.

In the JavaBuild settings, I left everything as is (I previous tried creating a src folder and importing all the .java files to it, but that didn't work). So my JavaBuild is just the default.


3- In the run configuration, I added:

C:\Users\Babylon\Documents\BNs\JavaBayes\JavaBayes-0.346\Source\BayesianNetworks

to the source lookup path, classpath and specified Tester.java (in the BayesianNetworks package/subdirectory) as my main class. Tester.java is a very simple java file containing nothing but a main method and is given in the third image.

4- When I attempt to run it, I get "Editor does not contain a main type" and can't execute my program (the fourth image).

Can I please know what on earth have I done wrong? I've been trying to figure this out for three hours now. I really appreciate any help I can get. Thank you again.


zibrahimAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
sweetfa2Connect With a Mentor Commented:
You specify a number of images, but none are available.

When you right click on the project and select BuildConfiguration
do you have the source file directories defined there?

Have you tried creating the project in another directory,and then copying the source file sinto it?
0
 
marklorenzCommented:
What type of project is it?  Web?  Java?  Make sure you create the right type of project if it isn't an existing Eclipse project.  If it is an Eclipse project, make sure you Import and pick Existing Eclipse project.
0
 
zibrahimAuthor Commented:
Hi again and thank you for your replies.

Sorry about the images, they're attached to this message.


 1st image 2nd image 3rd image 4th image
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
zibrahimAuthor Commented:
@sweetfa2: Yes, I added the source: C:\Users\Babylon\Documents\BNs\JavaBayes\JavaBayes-0.346\Source\BayesianNetworks to the build configuration (it wouldn't be there at first and I have to manually add it).

But no, I didn't try doing that, I will do so now and will let you know if it works, thanks.

@marklorenz: It's a java project. Also, I am merely importing the source because I don't have an eclipse project to begin with, the project I have was build using an editor and jdk. Thanks.
0
 
marklorenzCommented:
The error message seems to be saying that you are trying to execute a class that does not have a main() method.  If the class is a JUnit, try running it as that.  Otherwise, Eclipse will look for the main() method (a JUnit doesn't need a main() method).
0
 
zibrahimAuthor Commented:
Thank you guys, creating a new project then copying all the files to the src folder worked. I have another question now but I will post it in a new topic.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.