Understanding the Project Structure
In this section, we will focus on creating a new Java project and
understanding the project structure in the context of setting up a
development environment for Java programming.
Creating a New Java Project
To create a new Java project in IntelliJ IDEA, follow these steps:
1. Open IntelliJ IDEA and click on "New Project" on the welcome
screen. If you already have a project open, you can select "File"
-> "New" -> "Project" from the top menu.
2. In the "New Project" dialog box, select "Java" as the project type.
3. Choose the desired project SDK version and check the "Create
project from template" option.
4. Select the desired project template. For a simple project, "Java"
or "Command Line App" is a good choice.
5. Choose a location to save the project and click "Finish".
Understanding the Project Structure
When you create a new Java project, you will notice a specific project
structure:
● src: This folder contains the source code for your project.
● src/main/java: This sub-folder contains the main Java
classes.
● src/test/java: This sub-folder contains the unit tests for
your project.
● .idea: This folder contains IntelliJ IDEA specific project files,
such as configuration settings and caches.