Solved

Using Eclipse to Create Projects from Existing Source

Posted on 2010-11-19
6
804 Views
Last Modified: 2013-12-15
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.


0
Comment
Question by:zibrahim
  • 3
  • 2
6 Comments
 
LVL 17

Accepted Solution

by:
sweetfa2 earned 500 total points
ID: 34179458
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
 
LVL 12

Expert Comment

by:marklorenz
ID: 34179666
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
 

Author Comment

by:zibrahim
ID: 34180057
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:zibrahim
ID: 34180068
@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
 
LVL 12

Expert Comment

by:marklorenz
ID: 34180361
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
 

Author Comment

by:zibrahim
ID: 34180616
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

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org (http://seleniumhq.org) Go to that link and select download selenium in the right hand columnThat will then direct you to their downlo…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now