You can add the
src folder to build path by:
- Select Java perspective.
- Right click on
- Select Build Path > Use a source folder.
And you are done. Hope this help.
EDIT: Refer to the Eclipse documentation
All you got to do is move your Project folder under the Src, that is all, it is done. Let me know if any more questions.
In my case the source folder wasn't specified correctly. To solve the problem :
- Right click on project name in project explorer
Java Build Path
Sourcetab and inspect what is there. Make sure to
Add Folder...and select the folder which is the root of your source files.
As a result, you will notice that your folder structure in the project explorer will be modified to display package icons and package names instead.
Looks like you created your Java class under src/main/resources instead of src/main/java
If you imported a project from external source with pom.xml after import, go to Project->Properties->Maven and enable Java EE - This will resolve the error
If you open a file while in a perspective other than Java on a new project that hasn't yet been built and then go back to the Java perspective, you can get this alert message. Close the file and open it back up while in the Java perspective and then retry. Then if that fails the other solutions already provided will be of help.
- Import a project that is in a git repository
- Open the git perspective
- Open the Git Staging view
- Right click on a Java source file and select Open Working Tree Version
- Open the Java perspective.
- Now the "normal" Java features may not work correctly. Note that the file path is a literal path to the work station not the workspace.
Seems you imported the project to your workspace from git and not from a local repository. To add a local repository project to the workspace do the following:
Click on project (demoApp) -> imports projects -> finish.
Right click on your project -> Properties -> Project facets -> Convert -> Select Java in the checkboxes -> Apply and Close
Now you should be able to see your hierarchy.
Refactor the name of the folder
Right click the project > Build Path > Use Source Folder.
Using Eclipse Oxygen with a multimodule maven project make sure you're not editing the file in the maven parent project.
This caused the "Open Declaration', 'Open Type Hierarchy' and 'Open Call Hierarchy' to show the dreaded dialog in question. It would even mess with the autocomplete.
Make sure you are not editing the parent project and instead edit the child project to avoid the error.
- Delete project from workspace (Uncheck physical deletion of project from disk)
- go to project location and delete .project file
- Import the project again.
It means your project isn't on the compilation path of Eclipse. If after the accepted answer the problem still persists, then you need to first place that project on the compilation path.
For that, you need to import the project again into your workspace.
I found a similar issue and fixed it by correcting the
.project file. For a Java project the
.project file must have the below tag within the
Example of complete .project file
<?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name>SampleProjectName</name> <comment></comment> <projects> </projects> <buildSpec> <buildCommand> <name>org.maven.ide.eclipse.maven2Builder</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>oracle.eclipse.tools.weblogic.sharedLibraryFrameworkValidator</name> <arguments> </arguments> </buildCommand> </buildSpec> <natures> <nature>org.eclipse.jdt.core.javanature</nature> </natures> </projectDescription>
In my case, I had a java project containing many subfolders, each containing its own
project -subfolder --src/main/java -subfolder2 --src/main/java
There was no options available when I used the Build Path -> right click option, as outlined by other responses.
I had to go to Project -> Properties -> Project Facets and click
convert to faceted project.
Then I got all the
src folders added to the build path.
Recently I met a similar problem. When importing a project without a
.project file, a default empty
.project file was generated without builders. Here is an example
.project to make it work.
<buildSpec> <buildCommand> <name>org.eclipse.jdt.core.javabuilder</name> <arguments> </arguments> </buildCommand> </buildSpec> <natures> <nature>org.eclipse.jdt.core.javanature</nature> </natures>
I am trying to set up a dynamic web project using Eclipse and its Maven plugin. I am selecting maven-archetype-webapp and am facing the same problem (which I run into when trying to automatically produce getters and setters for some attributes).
My way around this was to right-click on the project, select Build Path --> Configure Build Path and then remove a weird exclusion filter "Excluded:**" which I found under the entry /src/main/resources.
- Eclipse: The resource is not on the build path of a Java project
- 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
- Cannot Perform Operation: The resource is not on the build path of a Java project
- Eclipse error "This compilation unit is not on the build path of a Java project
- The resource is not on the build path of a java project (eclipse)
- Resource is not on the build path of a java project --TFS--Eclipse
- 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 Oxygen - The project was not built since its build path is incomplete
- The resource is not on the build path of a java project?
- 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
- The compilation unit is not on the build path of a Java project - Maven
- Eclipse error in JSP file: The superclass "javax.servlet.http.HttpServlet" was not found on the java build path
- Eclipse Maven - Code Completion fails "This compilation unit is not on the build path of a Java project" and "Failed to Download Index" Error
- Eclipse project not added to the build path
- The question is for eclipse javaEE version. The project was not built since its build path is incomplete
- Eclipse Java Maven Project Java file which is not on a build path
- how to work with maven under eclipse ("This compilation unit is not on the build path of a java project")
- 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
- 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
- How can I use the java Eclipse Abstract Syntax Tree in a project outside Eclipse? (ie not an eclipse plugin)
- Eclipse Build Error "A class file was not written. The project may be inconsistent, if so try refreshing this project and building it"
More Query from same tag
- Rare error in Eclipse with brackets and ";"
- Eclipse : how to disable validation for SVG files
- Charset, encoding of JSP file in eclipse still ISO-8859-1?
- Eclipse change project files location
- Memory Analyzer (MAT) plugin not opening heap prof in MAT Eclipse 4.1.2 automatically
- Adding JAR to build path under a folder
- read html file from JSF project root folder
- Java get mouse position on click on Gui
- PyDev: Fatal error Python32\lib\io.py, line 60, in <module>
- How do I do commit a renamed file with case-sensitive using TortoiseGit?
- SSLHandshakeException when connecting to Openshift from EclipseIDE... How to solve?
- eclipse does not open my Javafx project
- how to create live trace search field in java
- Call to .NET web service timed out (Android dev using KSOAP2)
- Code document dialog in Eclipse
- Cygwin and Eclipse Helios setup
- Ivy + eclipse runtime dependencies deployment
- Remove Folder From Eclipse Workspace
- How do I speed up Eclipse Juno?
- Android "myLayout cannot be resolved or is not a field"
- Eclipse CDT : running C++ program not showing anything in the console! Why?
- Import "imports" in eclipse - Java
- CORS support for a Jersey app with WADL
- How to reference resource bundle?
- Where and how to add CSS in a Dynamic Web Project in Eclipse?
- error stopped application when press back key and rotate
- Win XP Autohide feature not working when Eclipse is running
- How to set up Chrome Developer Tools in Eclipse
- Eclipse project cannot include tchar.h
- Scala Editor in Eclipse doesn't work