This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi! I've created an Eclipse project, all its classes were already created and I only have to import them to my project, to do that I :
- right click my project and then select "Import"
- Select file system
- Browse to the .java and .class folders, they are in 3 folders (A, B, C) which i selected
- Then "finish"
Apparently this worked fine because now all the classes are in the 3 folders A, B and C folders in my "src" folder, but now when I try to Build, nothing happens and when I try to Run my main class I get the message "A in K does not exist", K is the name of my project and A is the folder where my main class is.
I tryied File/Refresh but it does not work.. seems like if my classes were not there..
Did you use the correct import statements for the existing classes in your new project? Do you declare the correct package for your new project? Also, are your folders marked as source folders in Eclipse? Your icons should look something like this:
Are you just trying to use those classes in your project? If so, it would be easier to place them in a JAR file and add that JAR to your build path.
Of are you trying to turn that set of classes into a project? If so, what I usually do is create a blank project of the correct type, and then copy the .java source files into the project. You can copy then outside of Eclipse, and then within Eclipse simply refresh the project. Or you can copy then from your file manager into your eclipse project. Both method work well for me.