[java] Why "no projects found to import"?

I am trying to "import existing project into workspace". As the "root directory" I select the directory where all my .java (and .class) files are located. Eclipse writes me that "no projects are found to import". Why?

This question is related to java eclipse import project

The answer is


Eclipse is looking for eclipse projects, meaning its is searching for eclipse-specific files in the root directory, namely .project and .classpath. You either gave Eclipse the wrong directory (if you are importing a eclipse project) or you actually want to create a new project from existing source(new->java project->create project from existing source).

I think you probably want the second one, because Eclipse projects usually have separate source & build directories. If your sources and .class files are in the same directory, you probably didn't have a eclipse project.


I had the same issue when I've modified .project xml-file. When I reverted files to original version the project was created, then I was able to import project. Maybe it helps someone who has the same kind of problem ;)


After a long time finally i found that! Here my Way: File -> New Project -> Android Project From Existing Code -> Browse to your project root directory finish!


This answer is same as Laura's answer , however, in new eclipse versions you will not be able to see a "create project from existing source" option.

Hence you can do this instead:

  • Goto File > New > Project

  • Select the type of project, click Next

  • Uncheck Use default location

  • Click on Browse to navigate to your source folder, or type in the path to your source

  • Click Finish

Taken from this discussion forum in eclipse.org


Reason : your ID is not able to find the .project file. This happens in git commit where many time people don't push .project file

Solution : If you have maven install then use following stapes

  1. mvn eclipse:clean
  2. mvn eclipse:eclipse

Enjoy!


In order to resolve this problem for android projects. follow the below mentioned steps new->android project->create project from existing source and in this you can give your code location. Now, it will import all the specified project code and will work fine


I have a perfect solution for this problem. After doing following simple steps you will be able to Import your source codes in Eclipse!


First of all, the reason why you can not Import your project into Eclipse workstation is that you do not have .project and .classpath file.

Now we know why this happens, so all we need to do is to create .project and .classpath file inside the project file. Here is how you do it:


First create .classpath file:

  1. create a new txt file and name it as .classpath
  2. copy paste following codes and save it:

    <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="output" path="bin"/> </classpath>



Then create .project file:

  1. create a new txt file and name it as .project
  2. copy paste following codes:

    <?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name>HereIsTheProjectName</name> <comment></comment> <projects> </projects> <buildSpec> <buildCommand> <name>org.eclipse.jdt.core.javabuilder</name> <arguments> </arguments> </buildCommand> </buildSpec> <natures> <nature>org.eclipse.jdt.core.javanature</nature> </natures> </projectDescription>

  3. you have to change the name field to your project name. you can do this in line 3 by changing HereIsTheProjectName to your own project name. then save it.


That is all, Enjoy!!


If you don't have I just have .project and .classpath files in the directory, the only way that works (for me at least) with the latest version of Eclipse is:

  1. Create a new Android project
    • File -> New -> Project... -> Android -> Android Application Project -> Next >
    • Fill in the values on this page and the following according to your application's needs
  2. Get your existing code into the project you just created
    • Right click the src file in the Package Explorer
    • General -> File System -> Next >
    • Browse to your project, select the necessary files, hit Finish

After this, you should have a project with all your existing code as well as new .project and .classpath files.


In new updated eclipse the option "create project from existing source" is found here, File>New>Project>Android>Android Project from Existing Code. Then browse to root directory.

enter image description here


One solution to this is to use Maven. From the project root folder do mvn eclipse:clean followed by mvn eclipse:eclipse. This will generate the .project and .classpath files required by eclipse.


if you are building a maven project through a command console, make sure the following is at the end of the command:

eclipse:eclipse -Dwtpversion=2.0

Examples related to java

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How much should a function trust another function How to implement a simple scenario the OO way Two constructors How do I get some variable from another class in Java? this in equals method How to split a string in two and store it in a field How to do perspective fixing? String index out of range: 4 My eclipse won't open, i download the bundle pack it keeps saying error log

Examples related to eclipse

How do I get the command-line for an Eclipse run configuration? My eclipse won't open, i download the bundle pack it keeps saying error log strange error in my Animation Drawable How to uninstall Eclipse? How to resolve Unable to load authentication plugin 'caching_sha2_password' issue Class has been compiled by a more recent version of the Java Environment Eclipse No tests found using JUnit 5 caused by NoClassDefFoundError for LauncherFactory How to downgrade Java from 9 to 8 on a MACOS. Eclipse is not running with Java 9 "The POM for ... is missing, no dependency information available" even though it exists in Maven Repository The origin server did not find a current representation for the target resource or is not willing to disclose that one exists. on deploying to tomcat

Examples related to import

Import functions from another js file. Javascript The difference between "require(x)" and "import x" pytest cannot import module while python can How to import an Excel file into SQL Server? When should I use curly braces for ES6 import? How to import a JSON file in ECMAScript 6? Python: Importing urllib.quote importing external ".txt" file in python beyond top level package error in relative import Reading tab-delimited file with Pandas - works on Windows, but not on Mac

Examples related to project

How to create a Java / Maven project that works in Visual Studio Code? IntelliJ does not show 'Class' when we right click and select 'New' error C2220: warning treated as error - no 'object' file generated Android Studio: Default project directory Error: Selection does not contain a main type How to open an existing project in Eclipse? The project was not built since its build path is incomplete Eclipse projects not showing up after placing project files in workspace/projects Method to find string inside of the text file. Then getting the following lines up to a certain limit "Sources directory is already netbeans project" error when opening a project from existing sources