Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between a source folder and a (normal) folder

I'm following this guide: Spring MVC and I realized that I do not know the difference between a source folder (src) and a plain folder.

I'm using eclipse, so maybe the difference is only useful in an IDE?

Also, I've noticed that java classes tend to go in src folders; whilst every other file goes into a plain folder (or the project root folder).

So, What is the significance of the source folder (src)? Why use a source folder over a plain folder?

Thanks!

like image 945
Eric Francis Avatar asked Oct 04 '12 21:10

Eric Francis


People also ask

What is a source folder?

Source folders are a way to cut down on a project's indexing scope. You can mark the folders that are part of your day to day work or part of a subsystem that you work on. All files inside source folders will be indexed and are, thus, searchable.

What is difference between folder and source folder in Eclipse?

A source folder is marked by Eclipse as containing java sources. Then, when you compile your project Eclipse will look for your source code into all your source folders. You can make any folder become a source folder adding it to the java build path.

What is a source folder in java?

The source folder is named src . It contains the Java code of the application. A few Java classes are also created together with the new project.

What is a source folder python?

A "source folder" is a directory that contains source files. Putting . py files into this directory will make them discoverable by PyDev, so that you can for instance import them from other Python files. A "PyDev Package" is a Python package.

What is the difference between a source folder and a package?

A source folder is the folder which is added to the PYTHONPATH. A package is a folder which has an __init__.py file (and which is located beneath a source folder). Thanks for contributing an answer to Stack Overflow!

What is a source folder in Eclipse?

A source folder is marked by Eclipse as containing java sources. Then, when you compile your project Eclipse will look for your source code into all your source folders. You can make any folder become a source folder adding it to the java build path. Thus, next time you compile your project Eclipse will also look for java classes in that folder.

What does 'folder' mean in Java?

'Folder' is just a folder in the filesystem sense of the term. because it would be very complicated to do otherwise. Yet, I'm guessing you could put it down lower. Typically, the source folder of a Java project would be named 'src'. classes) would be named 'test'. You do not need to mark more than the top-level Source Folder. So, both

What is the difference between a source folder and PyDev package?

A "source folder" is a directory that contains source files. Putting .py files into this directory will make them discoverable by PyDev, so that you can for instance import them from other Python files. A "PyDev Package" is a Python package.


Video Answer


2 Answers

A source folder is marked by Eclipse as containing java sources. Then, when you compile your project Eclipse will look for your source code into all your source folders.

You can make any folder become a source folder adding it to the java build path. Thus, next time you compile your project Eclipse will also look for java classes in that folder.

like image 115
admenva Avatar answered Oct 21 '22 22:10

admenva


The source folder contains your source code in relation to the project's build path. In the below Spring Boot project com.example.demo is in the classpath, indicated by package icon (and the .classpath file in the project's root, found outside of eclipse in the project's root folder). The path src/main/java/ is where this package is in relation to the root of the project.

enter image description here

You can remove a source folder (eg src/test/java/) from the build path by right-clicking on the folder Build Path > Remove from Build Path. To add it back to back by right-clicking on the folder that will contain your build path (eg src/test/java/) and then choosing Build Path > Use as Source Folder.

enter image description here

like image 45
TimeTrap Avatar answered Oct 21 '22 23:10

TimeTrap