Hello World Project creation and project configuration file Introduction Hello World Project Creation
- Click
Create New Project
Enter Wizard to create the project as shown in callout 1
- As shown in callout 1, if IntelliJ idea does not have an SDK configured at this point, you can click the
New...
SDK configuration first.
- As shown in callout 2, after configuring the SDK or selecting the SDK, click on
Next
the next step.
- As shown in callout 1, you can select a template to quickly create a project.
Command Line App
A class with the Main method is automatically created.
Java Hello World
automatically creates a class with the main method and prints the output Hello world.
- We do not check the use of templates, but manually created, so we click on Callout 2, go to the next step.
- As shown in callout 1, the default
More Settings
is not expanded, click here to expand more details of the information.
- As shown in callout 2, the project format file for IntelliJ idea is mainly available in two different ways
.idea (directory based)
When you create a project, you automatically create a .idea
project configuration directory to hold the project's configuration information. This is the default option.
.ipr (file based)
When you create a project, you automatically create a .ipr
project configuration file to hold the project's configuration information.
- It is important to note that my side of the project code created by default is GBK, and if you need to UTF-8, the way to change the code is to see the 10th.
- As shown in callout 1, according to the section "Introduction to icons for common file types" We know that the
src
directory is blue Source root
, and we can create packages and classes in this directory.
- As shown in callout 2, because the project is using JDK 7, the project is based on JDK 7, and we can call the classes in JDK 7.
- As shown in callout 1, 2, in the
src
right-click Directory, select New
Create package directory.
- As shown in callout 1, the package directory is linked by default in the absence of files, which makes it inconvenient to look at the directory-level relationship.
- Click on this gear to remove the option callout 2 from the pop-up menu, as shown in the callout arrows:
Compact Empty Middle Packages
.
- As shown, you can directly create,,,
Class
and Interface
Enum
Annotation
Other common types of files under a package.
- Like a Gif demo, write a main method that prints out Hello world.
- Like a Gif demo, run the Main method and print out Hello world.
Introduction to the project configuration file
- As shown in callout 1,
.idea
Project
the configuration file directory.
- As shown in callout 2, this is
.iml
Module
the configuration file.
- We also know from the above that the configuration changes of the IntelliJ idea Project are represented in these XML files, so we can also understand some of the configuration of IntelliJ idea by understanding these XML files. Also because of this feature, if we want to ensure that all project configurations are consistent in the project collaboration, we can consider uploading the configuration files to version control (including
.idea
directories and .iml
files). If these files are added to version control, then there is a point to consider, that is, after the collaboration Checkout project, after the project configuration according to their own needs, the project's XML file will also follow the changes. The files of these changes in the co-creators should not be uploaded to version control at this time. As for how to better control the files that you do not want to submit at any time, the next version control will be explained in detail.
Special Introduction
- IntelliJ idea is a non
Ctrl + S
-IDE, so every time you modify the code you just run or debug it without worrying about saving or losing code.
- Now, be confident and daring to start your Hello world.
10.Hello World Java Project creation and project configuration file explanation