IntelliJ idea to run your first Java application
Create a project let's create a simple Java Hello World project.
Click Create a new project.
Open the New Project Wizard.
The main item you should pay attention to is the SDK. The SDK (software Development Kit) is a set of software development tools that allow you to develop applications faster. IntelliJ idea does not include the SDK, so if you have not, download and install it. Because we do a Java project, we need a Java SDK (JDK).
When the installation is complete, click New to point to the installation folder for the JDK.
In the New Project Wizard, you can choose the technology supported by your project, but you are doing a normal Java application and do not need to select them, just click Next. The IDE then provides you with the creation of a project from a template. We don't need this now, so click Next.
Specifies the name and location of the project. Click Done.
You have the SRC folder in the project. This is the folder of your source code. Right-click the folder and select New | Java class.
Enter the name of this class "QuickStart. HelloWorld ", and click OK.
Now, the new class opens in the editor. Please note that this HelloWorld class is created in the QuickStart package. The text of the HelloWorld program is known
- Package QuickStart;
- public class HelloWorld {
- Public static void main(string[] args) {
- System.out.println ("Hello, world!");
- }
- }
Insert it into the class.
When you run an application, you need to have a configuration, and the process is basic. To create a run configuration, click Run | Edit the configuration, then click, and then select Apply.
Here, you can specify the main class and program parameters. Because we have a simple application, we just need to point out the main class. Put QuickStart. HelloWorld to the main class text field. Print something in the Name field, for example: HelloWorld. The run configuration is ready.
Now you can run your application immediately and make sure all works fine. Select Run | Run ' HelloWorld ' from the main menu.
Get results in the lower left corner of the window!
To debug the application, select Run | Debugging.
You also edit the configuration for this. To learn more, see Run/debug configurations: Apps.
You can set a breakpoint by clicking the left mouse button in the position of the page arrow before the line of code.
IntelliJ idea to run your first Java application