I have project, with source folder "app", inside this package I have package "models". Can I create folder or any other kind of subdirectory within this package? So that eventually I would have something like
-app
-models
-Folder1
-file1
-file2
-Folder2
-file3
-file4
When I try to force creating folder inside (by clicking new->other->folder), I cannot add anything to it.
I would suggest to add a resources folder at the top of your app tree so that your data and your classes are separated. But if you want to just add subpackage, do not create a new folder, just create a new package such as app. models. Folder1.
You can link to a folder by using the Advanced option on the New->Folder dialog or drag/drop the folder from a file system navigator (Explorer,Nautilus, etc) onto your project in Eclipse. You will get an option to copy the folder or link to it in the file system.
Yes, you can create a package inside a package in Java. It is called sub-package.
A package is basically the directory (folder) in which the source code resides.
Creating a folder within a package simply creates a new package
e.g. The folder structure
- app
- models
equates to package app.models
Adding a new folder, Folder1
to this structure
e.g.
-app
-models
-Folder1
equates to the package app.models.Folder1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With