Change default source directory src/java in eclipse for java project

re-structre

Change default source directory src/java in eclipse for java project

Prepare directory structure for maven by changing the default src

Probably you are using maven and wanted to change the directory structure.

Since maven recommends the standard src/main/java src/main/resource you might want to change it that way

Here is how to do it in eclipse.

First create the folder structure on the project in which ever way you would want to do it. I would use simple command like mkdir folderName to create it.

1. right click on the project, and hit refresh, make sure the folders you created are listed there.

2. Right click on the project, select properties and select java build path

3. Go to source tab

4. select and remove the current source folder, by default it would be src folder

5. Hit the Add newthen select your folder structure there.

maven directory structure

maven directory structure

This would change the original structure of the your java project from src to the one maven compatible.

See how to use maven to create starter boilerplate application
Get started with step by step j2ee and maven tutorial using eclipse

Can you solve these cool algorithm problems? See their solution as well

How do you find the maximum consecutive sum from the given array

You are given billion numbers and to look for a couple of missing numbers

From list of numbers in array, find those that are complementary to the given number

hello world weblogic – hello world tutorial on weblogic

Passing composite object parameter to jersey in Restful Java web

J2EE Maven Eclipse Hello World Tutorial Part Two

Check if two strings are anagrams or not

Java Tomcat error: can not access a member of class with modifiers

pass all the jars in classpath when compiling java

6 Comments
  1. prineblog

    Forgot how to do that.. :)

  2. Get Design

    This web site certainly has all the info I wanted about this subject and didn’t know who to ask.

  3. elBradford

    Thanks! Worked great.

  4. genericJavaProgrammer

    It sound like we just need to add a new source folder.

    In eclipse, right-click the project, then select “Build Path…”. Click “New Source Folder…” and then enter the name you want. “src/main/java” is what is typically used on maven projects. Click “Finish” and it will add the named source folder. Click “Next” if you want to specify inclusion/exclusion patterns.

    Then just move your classes from your original folder to the new folder and thats it. Hopefully you dont have too much to move around.

    I had built a helper utility, when I realized I should have made it a maven project. So I had to take care of this after I transitioned the project to be a maven project. But it still had the source in the original “src” folder.

  5. eebest8

    “A big thank you for your blog article.Much thanks again. Really Cool.”

  6. ZackHPatcher

    Awesome post.

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*