D
D
Drovosek012021-05-22 11:57:10
Java
Drovosek01, 2021-05-22 11:57:10

How to create subdirectories in IntelliJ IDEA project in src directory?

I'm starting to learn Java with an IDE from JetBrains using video tutorials.

This video https://youtu.be/xvUFqDKIKJE?t=685 shows the folder structure in the project src > main > java > Start.java

60a8c691d6e71926149176.jpeg

I created a Java project in IDEA and it had a blue src directory. I decided to repeat the directory structure as in the video and create subdirectories in src, I pressed RMB > New, but there was no item in the drop-down menu to create a subdirectory.

60a8c74d32920078424954.png

Why is this and how to fix it?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry Roo, 2021-05-22
@xez

Select create "package" - this is what you need

N
nApoBo3, 2021-05-22
@nApoBo3

They are not directories, they are packages.

O
Orkhan, 2021-05-22
Hasanly @azerphoenix

Good afternoon.
First of all, I wish you success in learning Java.

How to create subdirectories in IntelliJ IDEA project in src directory?

In Java, we operate not with directories, but with packages (Package), even though packages are essentially directories.
Right click on src and select New -> Package. Enter a package name.
To create a nested package, you can do the following:
1) Select the created package with the LMB (for example, com), and then New -> Package and enter the name of the new package.
2) Or there is a simpler way to create nested packages - to separate the names using the "dot" character.
When right-clicking on src , instead of just specifying a single name such as com, specify com.example.
I also recommend reading about the java naming convention and package naming rules.
Here. for example - developer.alexanderklimov.ru/android/java/package.php
https://metanit.com/java/tutorial/3.2.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question