for example if there are 4 project and a root project, add the other child projects to build path of root project. if there is not selection of build path, add below codes to .project file.
<?xml version="1.0" encoding="utf-8"?>
like the message says, is the file somewhere on the project's java build path (e.g. a source folder)?
had the same problem. solution: context menu -> maven -> enable dependency management
do not know why that was lost, when checking out.
i found that i was getting this error due to having my files, including my main class, outside of the .src folder.
what worked for me was copping the .settings/ directory from another project.
run "mvn eclipse:eclipse" from terminal.
if you're a beginner (like me), the solution may be as simple as making sure the parent folder that the file you're working in is a java project.
i made the mistake of simply creating a java folder, then creating a file in the folder and expecting it to work. the file needs to live in a project if you want to avoid this error.
i had same issue after importing maven project consisting of nested micro services. this is how i got it resolved in eclipse:
- right click on project
- select configure
- select "configure and detect nested projects"
your source files should be in a structure with a 'package' icon in the package explorer view (in the menu under window > show view > package explorer or press ctrl+3 and type pack), like this:
if they are not, select the folder containing your root package (src in the image above) and select use as source folder from the context menu (right click).
here the steps for creating a source folder in eclipse.
- right click on the project and go to properties
- select "java build path" from the properties dialog box
- select the source tab and check that the source folders are correct if not click on the remove button to remove source folders, or the add button to add source folders.
you can control the order in which source folders appear in a project on order and export tab on the configure build path option.
had the same problem (but with maven). the reason was incorrect choice of executor: my project used global settings that are not avilable from embedded installation of maven. changed it to external (window -> preferences -> maven -> installations) and that fixed the problem.
what i did is after importing the project from svn , deleted the project from workspace and imported it as a maven project from local . then in preferences->maven->usersettings->in usersettings box gave path of settings.xml which will be in apache maven folder-> conf->settings.xml
and it solved the issue for me.
i did copy the .classpath and .project from another project and adjusted the values properly.
close the project before editing those files, when you are sure they reflect the reality (your reality anyway), re-open the project in eclipse.
the workspace is rebuilt and all should work from then on.
in my case it's a maven project
delete the project from eclipse leaving the sources close eclipse delete from filesystem
.target/ .classpath .project .settings/ open eclipse again import maven projects
this solved the problem
you may want to try running eclipse with the -clean startup option - it tries re-building eclipse's metadata of the workspace.
solved my problem
did you have your .project file in your folders?
i got the same problem. than i realized that i didn't have the .project file.
i might be picking up the wrong things from so many comments, but if you are using maven, then are you doing the usual command prompt build and clean?
go to cmd, navigate to your workspace (usually c:/workspace). then run "mvn clean install -dskiptests"
after that run "mvn eclipse:eclipse eclipse:clean" (don't need to worry about piping).
also, do you have any module dependencies in your projects?
if so, try removing the dependencies clicking apply, then readding the dependencies. as this can set eclipse right when it get's confused with buildpath sometimes.
hope this helps!
i also had this problem after converting my java project into a maven project. i solved it as follows:
right click on your project ->project facets -> click on java, then apply.
i have this issue from time-to-time and often it's because the project wasn't marked as a java project. you can change this by going to the properties for the project > project facets > and selecting java. you may then need to properly configure that project, but this is probably part of the problem
what i did to make one of my projects to check out properly is by
1) import your project from svn
file-->import-->svn-checkout projects from svn
2) find your project and then in the "check out as" dialogue make sure you have the radio button selected "check out as a project configured using the new project wizard"
3) go through regular steps.
the wizard pulls the project properly and then setups your eclipse....
without using the wizard i find that all hell breaks loose.....
hope this helps...
this is what was missing in my .project file:
when you have a multimodules maven project under a parent project, make sure you're not editing the file in the maven parent project.
- This compilation unit is not on the build path of a Java project
- Eclipse Oxygen This compilation unit is not on build path of java project
- Eclipse error "This compilation unit is not on the build path of a Java project
- Eclipse "this compilation unit is not on the build path of a java project"
- Compilation unit is not on the build path of a Java project
- The compilation unit is not on the build path of a Java project - Maven
- Eclipse Maven - Code Completion fails "This compilation unit is not on the build path of a Java project" and "Failed to Download Index" Error
- how to work with maven under eclipse ("This compilation unit is not on the build path of a java project")
- "This compilation unit is not on the build path of a java project" -Eclipse
- Debugging with Jetty Maven Plugin in Eclipse on multi module project: Compilation unit not on the build path
- Eclipse: The resource is not on the build path of a Java project
- Eclipse Build Error "A class file was not written. The project may be inconsistent, if so try refreshing this project and building it"
- Eclipse Oxygen - The project was not built since its build path is incomplete
- The resource is not on the build path of a Java project
- Eclipse > Remote System Plugins > Error : the resource is not on the build path of a script project
- Eclipse error in JSP file: The superclass "javax.servlet.http.HttpServlet" was not found on the java build path
- Cannot Perform Operation: The resource is not on the build path of a Java project
- Eclipse project not added to the build path
- The resource is not on the build path of a java project (eclipse)
- The question is for eclipse javaEE version. The project was not built since its build path is incomplete
- Resource is not on the build path of a java project --TFS--Eclipse
- Eclipse Java Maven Project Java file which is not on a build path
- My imported eclipse project gives error the project was not build since the build path is incomplete. Cannot find the class file for java.lang.object
- Eclipse Mars - The project was not built since its build path is incomplete
- class not found exception in eclipse even though the user library containg jar file is in java build path
- Why does this Java code generate an error in one Eclipse project but not the other?
- Eclipse building the project with a different JRE than the one provided in java build path
- The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
- The project was not built since its build path is incomplete
- the project yyy does not have any gwt sdks on its build path
More Query from same tag
- maven : mvn clean package throwing error "Input is not in the XZ format. "
- How do I set a folder as a Source Folder in Eclipse with Gradle?
- Import PhoneGap project into eclipse
- How to add few classes from a jar file to my project in eclipse?
- In IntelliJ is there an easier way to set up the "Complete Current Statement" like eclipse?
- LoopJ AndroidAsyncHttp - Parameters - Conflict
- Gradle- Eclipse and IDEA plugin in same script?
- What is the type of variable is the RatingBar and how to obtain it?
- Android File explorer to access child of child
- Getting java.lang.RuntimeException: Cannot get the System Java Compiler. What could be the reason for it?
- Spring 3.1.1 and Cache configuration issue
- how to define in manifest file which is activity of another
- git-receive-pack not permitted while pushing the code from eclipse to GitHub with access token
- How to upload file to a project directory using Spring MVC?
- Joda Time - Cannot run JUnit tests in Eclipse or IntelliJ
- Eclipse Android: how to use a library project with linked folders?
- How to open an archive file in eclipse?
- Creating svn user
- Adding an include directory to all configurations in Eclipse
- Set top level link in Eclipse InfoCenter TOC using DITA-OT
- Junit Testing with .launch file
- Classes and libraries not being included in Google App Engine web application?
- Error while loading eclipse (Not able to run any android application)
- Eclipse Error: Could not find or load main class
- eclipse not using/finding build path sources?
- eclipse crash after opening on ubuntu
- Move Plugins between different Eclipse versions
- Undecorated window using eclipse plugin classes
- No ADT plugin options available
- Drawing a bufferedimage slow in Windows, fast in Linux