Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I create folder inside package in eclipse?

Tags:

java

eclipse

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.

like image 469
Xyzk Avatar asked Nov 14 '13 02:11

Xyzk


People also ask

Can we create a folder inside a package in Eclipse?

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.

How do I create a folder in Eclipse?

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.

Can we create package inside package?

Yes, you can create a package inside a package in Java. It is called sub-package.

Is package and folder same?

A package is basically the directory (folder) in which the source code resides.


1 Answers

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

like image 122
cmd Avatar answered Oct 06 '22 23:10

cmd