[eclipse] Eclipse+Maven src/main/java not visible in src folder in Package Explorer

I'm wondering why I can't see following folders in src node in Package Explorer

src/main/java
src/main/resources
src/test/java
src/test/resources

I can access those folders as direct children of the project and they exist in the file system.

I'm using Spring Tool Suite (STS of Eclipse).

Maybe I can configure Eclipse somehow ?


enter image description here enter image description here enter image description here

This question is related to eclipse maven spring-tool-suite

The answer is


I had a similar issue when I checked out a web project from a github repo on my eclipse. src/main/java was directly inside the project root in Package Explorer. My expectation was that src/main/java be visible inside a source folder "Java Resources". There were few things which I did to achieve this.

  1. Right click on Project > Build Path > Configure Build Path..
  2. Select filter "Java Build Path" and click on Tab "Libraries" Verify your "JRE System Library". If it is not pointing to your latest JDK, then you can click on Edit Button and follow the subsequent dialog boxes to select most appropriate JDK home path in your system. Once done click Apply, Apply and Close, Finish to close all the associated open boxes for the current filter.
  3. Select filter "Java Compiler" and ensure your JDK Compliance points to correct JDK. Click Aapply
  4. Select filter "Project Facets". Ensure both Java and Dynamic Web Module is selected with correct version.
  5. Click Apply and Close.
  6. Source folder "Java Resources" gets created with src/main/java in it when viewed in Project Explorer.

I used this tutorial to create my maven web project http://crunchify.com/how-to-create-dynamic-web-project-using-maven-in-eclipse/ and eclipse did not create src/main/java folder for me. When i tired to create the source folder src/main/java eclipse did not let me. So i created the folder outside eclipse in the project directly and then src/main/java appeared in eclipse.


This error happens when there are no files inside /src/main/java Just make some empty files inside and the problem will go away.

A side note: lots of version control systems (mercurial for example) do not commit folders if there are no files inside.


After creating the project go to properties --> build path --> configure build path --> order and export tab and check jre and maven dependencies. You will then have the folder.


I have solved this issue by below steps:

Right click the Maven Project -> Build Path -> Configure Build Path In Order and Export tab, you can see the message like '2 build path entries are missing' Now select 'JRE System Library' and 'Maven Dependencies' checkbox Click OK Now you can see below in all type of Explorers (Package or Project or Navigator)


If none of the answers worked for you. You might be in the wrong "Window". I was in "Package explorer" and switching to "Project Explorer" showed me the folders.


I was not able to see the build path option in the properties as well. Also the

src/main/java

was not visible in Project Explorer. below solution worked for me

  1. Go to Project root
  2. Select "Project facets" from Properties
  3. Check "Java"

This fixes the issue


I have solved this issue by below steps:

  1. Right click the Maven Project -> Build Path -> Configure Build Path
  2. In Order and Export tab, you can see the message like '2 build path entries are missing'
  3. Now select 'JRE System Library' and 'Maven Dependencies' checkbox
  4. Click OK

Now you can see below in all type of Explorers (Package or Project or Navigator)

src/main/java

src/main/resources

src/test/java

Navigate > Show In > Package Explore


I had the same problem, I changed my Eclipse project view from Package explorer to Project Explorer.


Right click on eclipse project go to build path and then configure build path you will see jre and maven will be unchecked check both of them and your error will be solved


Right click the Maven Project -> Build Path -> Configure Build Path Go to Order and Export tab, you can see the message like '2 build path entries are missing' Now select 'JRE System Library' and 'Maven Dependencies' checkbox Click OK


My problem was kind of the same at first and then a little different in the sense that when /java folder showed up, it was deep down in a nested folder somewhere in src/main/resources/java.

Initallially the problem was being in the Package Explorer and not in the Project Explorer as many people have talked about. So,

  • a. right-click on your project root
  • b. show in, and select Project Explorer

However, the main problem was I missed to notice a checkbox at the second step of Maven Project Creation from the wizard. That got me created a complicated structure and not a clean direct one.

enter image description here

Once I marked it checked I got a clean project structure as what asked.


I used to get the same problem, but solved it by pointing to the right jre used for the project.

Right click on the project properties java builpath see the jre selected edit it select alternate jre installed jre select the right one ok After changing right click on project>maven>update project

Hope it helps. Attaching screen shot.enter image description here


If you are looking for Simple/quicker way, you can follow this solution.

  1. Right click on your project.
  2. Goto > Build Path > Configure Build Path > Java Build Path
  3. Goto 'Source' tab, there, you can see like <<your_project_name>>/src/main/java(missing).
  4. Click on it and remove.
  5. Click on Apply and Close.
  6. Now, right click on project and >New > Source folder > add source folder "src/main/java".

happy learning and do not forget to upvote :)


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 maven

Maven dependencies are failing with a 501 error Why am I getting Unknown error in line 1 of pom.xml? Why am I getting "Received fatal alert: protocol_version" or "peer not authenticated" from Maven Central? How to resolve Unable to load authentication plugin 'caching_sha2_password' issue Unable to compile simple Java 10 / Java 11 project with Maven ERROR Source option 1.5 is no longer supported. Use 1.6 or later 'react-scripts' is not recognized as an internal or external command How to create a Java / Maven project that works in Visual Studio Code? "The POM for ... is missing, no dependency information available" even though it exists in Maven Repository Java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/exc/InvalidDefinitionException

Examples related to spring-tool-suite

maven... Failed to clean project: Failed to delete ..\org.ow2.util.asm-asm-tree-3.1.jar Eclipse+Maven src/main/java not visible in src folder in Package Explorer