Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Using Eclipse to Create Projects from Existing Source

Posted on 2010-11-19
6
Medium Priority
?
820 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 2000 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
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 perform CRUD operations on a MySql database.

972 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