0

I want to create two main folders under src folder. When i try this it creates in normal way as seen in image.

enter image description here

How can i create folders in this way.

enter image description here

src/main/java
src/main/resource

I have tried searching google and other websites. Nothing seems working. Also the option when you press ctlr+F10 doesn't seem to solve my problem.

Tatkal
  • 568
  • 4
  • 9
  • 29
  • 2
    In your screen you have exactly that. Not sure what you're asking. – tkausl Apr 11 '18 at 06:23
  • As you can see in image. It create subfolders under src and then main. I have seen some projects where it is been created as src/main/java. How can i do the same thing in my project. – Tatkal Apr 11 '18 at 06:28
  • 1
    You literally want a directory named `src/main/java`? Thats not possible. – tkausl Apr 11 '18 at 06:30
  • Check my latest edited post – Tatkal Apr 11 '18 at 06:30
  • The second screen has the same directories, it just shows them differently. – tkausl Apr 11 '18 at 06:32
  • They both are the same thing, src/main/java means you have a src folder and under that main folder and under that, java. – Akshay Batra Apr 11 '18 at 06:33
  • I know both are same thing. But I want to know how can I create in the desired way? – Tatkal Apr 11 '18 at 06:36
  • This is not possible as the forward dash is not accepted as part of a folder or file name in neither Win nor Linux (tested on Ubuntu). This is probably because it is a path delimiter and therefore reserved for that use. – tringel Apr 11 '18 at 06:47
  • This is just the way the view is presenting the folders, nothing to do with actual names of the folders. Is this Package Explorer, Project Explorer or something else? – greg-449 Apr 11 '18 at 06:49
  • The right terminology is "how to create a classpath folder in Eclipse" rather than a forward slash. This has nothing to do with [tag:spring-boot] and it has been asked on Stack Overflow already as well: https://stackoverflow.com/questions/25162773/how-do-i-add-a-directory-to-the-eclipse-classpath. – g00glen00b Apr 11 '18 at 07:15
  • 1
    Possible duplicate of [How do I add a directory to the eclipse classpath?](https://stackoverflow.com/questions/25162773/how-do-i-add-a-directory-to-the-eclipse-classpath) – g00glen00b Apr 11 '18 at 07:16
  • Create a new project as a "Maven Project" (not as a "Java project"), then Eclipse will create this directory structure with /src/main/java and /src/main/resource – Rodrigo Eggea Nov 23 '21 at 17:55

1 Answers1

3

main>Folder --Right click--Build Path and select

use as a source folder

image

Faysal Ahmed
  • 7,501
  • 5
  • 28
  • 50
dinesh ch
  • 46
  • 1