'Eclipse -- Testng references non-existing project XXX, launch configuration

When trying to run a test as a TestNG suite, I would get a very cryptic error message saying that TestNG can't launch because it references a non-existant project. I think my project does exist, I see it in the package explorer!



Solution 1:[1]

It turns out you just have to make sure your project is a Java Project, and not a Simple project. Check that the navigator shows a little blue 'J' associated with the folder. If not, then you have created a Simple project.

"It would appear that the project you created is not Java project.

Eclipse auto-builds the .java file to .class files for all .java files contained in a Java project.

To create a Java project File>New>Project>Java Project Give the project a name. Click Finish"

Found this answer hidden deep in this source.

In eclipse you should be using Navigator and not Package explorer, as navigator is browsing the actual filesystem, where package explorer is loading certain things only. In the future hopefully people can find the solution more easily.

Solution 2:[2]

I have faced the same problem while I was working with raspbian OS for raspberry pi. The problem was the java project was referencing to one of my previous project.

I resolved this problem by doing following steps.

  1. Go to Project->properties
  2. In properties window's left pane select "Run/Debug Settings".
  3. Select "Configure" and click "edit"
  4. In tab "Main" replace Project to your current project.
  5. Select "Main class" by clicking on search button(it will be your class name).
  6. Now hit OK.

Solution 3:[3]

I know this is an old post, but I hit this recently when I moved to using a MacBook Pro.

When I created a new Eclipse workspace and loaded all of my projects from the SCM, I got these Ant failures due to referencing an non-existing project.

The solution was not easy to discover, but the solution is simple: Change your Ant run configuration's JRE to run in the same JRE as the workspace.

You DO NOT need to change your build projects to Java projects.

Solution 4:[4]

Solved in a different way for the same issue.

1) Go to Project->properties.

2) In properties window's left pane select "Project Facets".

3) Then click on "Convert to faceted form"

4) Then choose your server and JDK version.

Apply and Close.

Note: Verify the project and the default IDE JRE is same version.

Solution 5:[5]

This issue will manifest for you if you have a test class in a current project that you are trying to run that matches a test class from the project that you either closed or deleted and had previously run unit tests against.

Chances are you have a test case from this deleted / missing or closed project. Eclipse will hide the launch configurations of deleted and closed projects but still attempts to use them when you do the 'right click on class' -> 'run-as' way to invoke a unit test.

The solution here is to unhide the problem launch configuration so you can delete it or modify it to conform to the current project.

Unhide the launch configurations of deleted and closed projects:

This is done via the dropdown menu path -> Eclipse -> Preferences -> "Run/Debug" -> Launching -> "Launch Configurations" In the "Launch Configurations" screen find the "launch configuration filters" section and uncheck the top 2 checkboxes: - "Filter configurations in closed projects" - "Filter configurations in deleted or missing projects" click the "Apply and close" button and close the popup screen.

Edit / delete the problem configuration:

open the Run -> "Run configurations" from the dropdown menu. On the left find and select the (no longer hidden) run configuration. In this configuration you can either update the project references to the current project or you can delete the configuration altogether. If you delete the run configuration eclipse will create a new one from scratch with the correct project settings when you attempt to "run as" on the current class.

Solution 6:[6]

In my case the run shortcut was referencing an old project.

Simply right clicking on the folder of the project I was trying to run and selecting my java class fixed the problem.

After that pressing the run button started working again.

Solution 7:[7]

If its an existing project, you must have classpath and project file in project root folder to make it java project.

Sample:

<!--classpath -->
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
    <attributes>
        <attribute name="optional" value="true"/>
        <attribute name="maven.pomderived" value="true"/>
    </attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
    <attributes>
        <attribute name="optional" value="true"/>
        <attribute name="maven.pomderived" value="true"/>
    </attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
    <attributes>
        <attribute name="maven.pomderived" value="true"/>
    </attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
    <attributes>
        <attribute name="maven.pomderived" value="true"/>
    </attributes>
</classpathentry>
<classpathentry exported="true" kind="con" path="GROOVY_DSL_SUPPORT"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
    <attributes>
        <attribute name="maven.pomderived" value="true"/>
    </attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>

<!-- .project  -->
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>testProject</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
    <buildCommand>
        <name>org.eclipse.jdt.core.javabuilder</name>
        <arguments>
        </arguments>
    </buildCommand>
    <buildCommand>
        <name>org.eclipse.m2e.core.maven2Builder</name>
        <arguments>
        </arguments>
    </buildCommand>
</buildSpec>
<natures>
    <nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
    <nature>org.eclipse.jdt.core.javanature</nature>
    <nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>

Solution 8:[8]

It doesn't have to be a Java Project, it could be a Maven one as well. There could be a reference problem with the oldest version of the project. Please try deleting the oldest version from your Eclipse workspace, and then change your reference point.

Solution 9:[9]

In my case, the error occurred in a Scala project. It had installed the eclipse plugin, but it had not been used yet.

Diagnostics: If all goes well, the project has a blue S for scala project. If not, it has a yellow PC mouse (for whatever that means).

To fix, you need to

sbt eclipse

on the command-line. Eclipse recognizes it as Scala project at the latest on restart.

Solution 10:[10]

I resolved the issue, follow the below steps:

Right Click on Feature file> Run configurations>check for the feature path and classpath .. It was taking path of previous project. Resolved the issue after selecting current project

Solution 11:[11]

I also got the same problem but solved it just by deleting test runner. Go to file-->Properties-->Run/Debug Setting -->click on test runner and delete it. After this step your eclipse starts working normally as it was before!.

Solution 12:[12]

I got this issue when I imported the non maven project to my local workspace from our project repository Configure build path was also disabled. This is because the nature of the project was not set to java. Right click on your project->select properties->Project Natures->Select Java. This will enable build path and you can add all the dependencies which will resolve the issue

Solution 13:[13]

I faced this issue when I imported the project into local from the repo. Reference library was disabled and was not allowing me to add external jars. I opened project properties(Right click on project->Properties) and added Java as the nature of the project. It worked!