Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Using Eclipse to Create Projects from Existing Source

Posted on 2010-11-19
6
811 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

 

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

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Visual Studio 2013 5 79
error when checking java version 4 4,634
selectallvieditor 6 119
Eclipse Neon and jdk 1.8.0 11 255
Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
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…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

790 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