This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
When I try to download source code for an example and then import it to eclpise, most of the time it will not work for me. I download the project as a zip file. Then in eclipse Ill go to file->import->existing project into workspace
I then select "Select Archive File:" and browse to the zip file I just downloaded.
Sometimes this will work for me, but most of the time the "Projects" space will have nothing in it and the Next button will still be greyed out. But then other times the projects space will populate, the Next button is activated and I can import with no issues.
I've noticed the projects that will not import always have a very different file structure than the default structure in eclipse. And the files I can import have the exact same file structure. I'm sure this is part of the issue, but I have no idea what to do to get around this.
True wisdom is in knowing you know nothing - Socrates
I am trying to import JSF projects I shouldve said. These are not projects I have exported, they are samples online from other people I am trying to download.
Here is the file structure Im used to:
Whenever I try to import a jsf project from someone online that follows this file structure I can do so just fine. However when i get a project that differs in any way (usually there will be something like a class folder to hold all the classes, etc) I get the problem as I described above.
sorry, I read too hastily and did not comprehend your response.
and looking into it, no the metadata is not there.
a good example is at www.corejsf.com
That is the accompanyng site for a textbook I bought. It has a lot of example code. Each chapter has examples, each with a src and a web folder, containing the usual stuff. I misunderstood how eclipse imported projects. I assumed as long as the src and web folders were present eclipse would construct the project. Just by your response though I realize where I was wrong about this. My question is answered now, thank you
This is tricky. You can't literally import a project into Eclipse - just its files. To establish a project as an Eclipse project, you have to build an actual Eclipse "project".
In other words, use the File/New menu to create a blank project, including the ".project" file. CVS checkouts also do that as an option when importing from CVS, but they're still creating a project and then filling it in, not simply downloading it.
Importing files into a project is REALLY tricky. The Eclipse import/export functions are not very good at letting you root your project files in the right place.
As an example, suppose I exported my project "XYZ", and its original root was the "XYZ" directory. When I export it, the XYZ directory and all its subdirectories (subject to my selections) will be exported. Now let's assume I wanted to clone the project and name it "ABC". If I import the zipfile, I have to first designate the target project. So I build a project named "ABC" and import it.
At this point, one of 2 things will bite me.
1. The import won't let me root things properly, resulting in an ABC/XYZ directory structure.
2. The import will want to import into XYZ, not ABC
In practice, I usually address this by importing XYZ under ABC, exiting Eclipse, then hoisting all the files and directories in ABC/XYZ up a level (that is, from ABC/XYZ to ABC), then removing the now-empty ABC/XYZ directory. Then I restart Eclipse and refresh the project, if needed.
It's quite safe to overlay the .project and .classpath files that were created when you defined the ABC project with .project and .classpath that was included in the XYZ zip. But it is safer to do this while Eclipse isn't running, which is why I shut down Eclipse while moving the files.
Customer surveys are for companies who didn't pay proper attention to begin with.