How to create a Java Maven project using Command Line in IntelliJ

HOME

In the previous tutorial, I have explained How to create Maven Java project in Intellij without Command Line. In this tutorial, I will explain about creation of Java Maven Project using Command Line in IntelliJ.

Step 1 – Open IntelliJ IDEA IDE. Click on Terminal Button as shown in the below image.

Step 2 – Go to the path where you want to create the project. This can be done by typing command

cd path of folder

Step 3 – This tells Maven to generate a Java project from a Maven template.

mvn archetype:generate

Step 4 – We need to mention the number as displayed on your screen in Command Prompt to proceed further. Like here, Choose a number or apply filter has 1771, so I have also mentioned 1771 in command prompt.

Step 5 – We need to provide again input in command prompt. This time program wants to know which version we want to use. I prefer to use the latest version. Here, it is 8, so I have selected version 8.

Step 6 – We need to provide 2 input here

A) Value of groupId – This serves as the group identifier of your Maven project, it should be in a form similar to Java packages, such as com.example
B) Value of artifactId – This serves as the group-local identifier of my Maven project like MavenIntelliJFromCMD
C) Value of Version – The initial version of our project. The default is 1.0-SNAPSHOT
D) Value of package – The name of our root package. The default is groupId we have created earlier.
We will notice the INFO message about the properties.

If the displayed settings are correct, then just enter Y in :: prompt.

Step 7 – Successful Build – Below screenshot shows that the Maven IntelliJ Project built successfully.

Step 8 – Contents of Project Folder – Open folder MavenIntelliJFromCMD to see the contents of the folder. It should have POM file and src.

This project can be imported in IntelliJ and can be used further. To know how to import Java Maven project in Intellij, click here.

That’s it! We have created a Maven Project in IntelliJ using Command Line.

Congratulations on making it through this tutorial and hope you found it useful! Happy Learning!! Cheers!!

Advertisement

How to import Java Maven project in IntelliJ

Home

In the previous tutorial, I have explained How to create a Maven Project in IntelliJ. In this tutorail, I will explain how we can import a Java Maven project in IntelliJ IDE.

Step 1 – Open IntelliJ IDEA and Welcome Screen appears. Click Open button present on Welcome Screen.

Step 2 – Navigate to your Maven project and select the top-level folder. Select the project you want to Import. As you can see, I have selected – MavenProjectFromCMD option. Select OK button to proceed to next screen.

Step 3 – A screen appears to Open or Import project. It will have all the possible configurations for the project. As this is a Maven project, select Maven project and click OK Button.

Step 4 – A warning message box will appears. Select Trust Project Button and move forward.

Step 5 -This screens shows that the project is imported.

Step 6 – Run the test present in the project. Here, I have run AppTest. Right click on AppTest ->Run ‘AppTest’. Below screen shows that the project is imported successfully.

That’s it! So Simple!!!

Congratulations on making it through this tutorial and hope you found it useful! Happy Learning!!

How to create Maven project in IntelliJ

HOME

In the previous tutorial, I explained how to create a Simple Java project in IntelliJ IDEA IDE. In this tutorial, I will explain about creating a Maven project in IntelliJ IDE.

Step 1 – Open the IntelliJ. It will look as shown below. To create a New Project, click on New Project Icon.

Step 2 – Click on File Option, hover on New Option, and click on Project Option as shown below.

Step 3 – Select New Project as Maven.
Project SDK should be current Java version available.
Select option for Create from archetype. This will enable the options to select archetype.
Select archetype : maven-archetype-quickstart.
Click on the Next Button.

Step 4 – Below screen will appear. Mention the Name, Group Id, Artifact Id, and Version. Click the Finish button

Name : MavenIntelliJDemo
Group Id : com.example
Artifact Id : MavenIntelliJDemo
Version : 1.0-SNAPSHOT

Step 5 – Verify the information in the below screen. Click on Finish Button.

Step 6 – This dialog box will appear on the screen. This provides you the option to open the project in the current window or will open a new window with this project. I’m selecting the option – New Window.

Step 7 – This screen shows the structure of the Maven project as well as the POM.xml file.

Step 8Project Folder Creation – We can see a folder with the name of the project – MavenIntelliJDemo in our Eclipse Workspace.

This is how we can create the Maven project – MavenIntelliJDemo in IntelliJ.

That’s it! Congratulations on making it through this tutorial and hope you found it useful! Happy Learning!!

How to create a Java project in IntelliJ

Home

In the previous tutorial, I have explained how to download and install IntelliJ on Windows. In this tutorial, I will explain about how to create a Java project in IntelliJ.

  1. Open the IntelliJ. It will look as shown below. To create a New Project, click on New Project Icon.

2. Select Project SDK as Java version present on your system and select option as Java. Click on Next button.

3. The next screen provides options to choose Project Template as shown below. Click on the Next Button.

4. I have mentioned Project Name as Java Demo and path where I want to save my project on my computer.

5. Click on the Finish Button to create the project. It will also ask to create the directory as shown below.

6. Click Create button to grant permission. It will launch IDE as shown below.

Now, I have created a new Java Project named as Java Demo. Let me create a new Java Class – HelloWorld.

  1. Expand the Project Hello Word and right-click on the src folder, hover on New Option and click on Java Class Option as shown below.

2. I have provided the Java Filename with the package as shown in below image. Now press Enter Key to create the packages and Java file.

3. It will show a message to Add the File to Git. Depending on your requirement select Add or Cancel. I don’t want to add File to Git, so selected Cancel.

4. I have updated the HelloWorld class to print First Java Class -Hello World on the console as shown in the below image.

5. Now right click on the HelloWorld class file and choose Run HelloWorld.main() Option or press Ctrl + Shift + F10 to compile and execute the program as shown in below image. It will also build the project.

6. The final output of the program will be displayed on the console as shown below.

This is how we can create the Java Demo project to execute our first program in Java – HelloWorld.

That’s it! Congratulations on making it through this tutorial and hope you found it useful! Happy Learning!!

How to install IntelliJ on Windows

HOME

IntelliJ IDEA is one of the smartest IDE for Java development. It’s also the base of the official Android IDE i.e. Android Studio used for Android mobile application development. This tutorial provides all the steps required to install IntelliJ Idea on Windows 10 for Java development.

Download IntelliJ on Windows

  1. Click this link to download IntelliJ IDEA on your machine. It will open the download page as shown below. The IntelliJ IDEA provides two different installers i.e. Ultimate and Community. The Ultimate edition is commercial version (which has trial version for 30 days post which you needs license). The Community edition can be used for free. This tutorial shows the steps required to install the Community edition.

2. Download IntelliJ by clicking on Download button and use any one of the option either .exe or .jar. Below image shows IntelliJ.exe on your machine.

Installation of IntelliJ IDEA

  1. To start installation, double click on the idealC-2021.exe (this version can change in future).

2. It will show the welcome screen as shown below. Click on the Next Button to continue with the installation.

3. It will provide options to choose the installation location as shown in below image. Make sure that you have sufficient space available on the selected drive since it will consume around 1.6 GB storage. Click on the Next Button after choosing the appropriate installation path.

4. It will show the Installation options as shown below to configure system path, create 64-bit desktop launcher icon, Open Folder as Project, and file association for Java, Groovy, and Kotlin files. I have selected the option to create a desktop launcher icon. You may choose the options based on your requirements. Click on the Next Button after choosing the Installation Options.

5. After choosing the Installation Options, the next screen shows options to configure the Start Menu Folder as shown below.

6. Click on the Install Button after selecting the Start Menu Folder option. It will show the installation progress as shown below.

7. It will show the final screen after successfully installing IntelliJ IDEA as shown below.

8. Click on the Finish Button to close the installer. Below image shows that IntelliJ icon is placed at Desktop as we have selected in the previous step.

That’s it! We have downloaded and installed IntelliJ. Congratulations on making it through this tutorial and hope you found it useful! Happy Learning!!

In the next tutorial, I’ll explain how to create a new project in IntelliJ.

Maven Tutorials

 HOME

 

Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project’s build, reporting and documentation from a central piece of information. Maven is a part of the Apache Software Foundation.

Maven Installation

 Chapter 1 Maven – How to install Maven on Window

Eclipse IDE

Chapter 1 Maven – How to create a Java project using Command Line
Chapter 2 Maven – How to create Maven project in Selenium
Chapter 3 Maven – How to import Maven project in Eclipse
Chapter 4 Maven – How to add M2_REPO classpath variable to Eclipse

IntelliJ IDE

Chapter 1 How to create Maven project in IntelliJ
Chapter 2 How to import Java Maven project in IntelliJ
Chapter 3 How to create a Java Maven project using Command Line in IntelliJ

Java Tutorials

Java is a general-purpose programming language that is a concurrent, class-based, and object-oriented language. Java follows the concept of “write once and run anywhere (WORA)” which means that compiled Java code can be run on all different platforms that support Java without the need for recompilation.

Eclipse IDE

Chapter 1 How to Download and Install Eclipse IDE
Chapter 2 How to Clone a project from GitLab using Eclipse
Chapter 3 How to Export Eclipse projects to GitLab

IntelliJ IDE

Chapter 1 How to install IntelliJ on Windows
Chapter 2 How to create a Java project in IntelliJ
Chapter 3 How to Clone a project from GitLab using IntelliJ
Chapter 4 How to Export IntelliJ project to GitLab

Basics of Java

Chapter 1 How to Download & Install Java JDK 11 in Windows
Chapter 2 Data Types and Operators in Java
Chapter 3 Decision Making in Java – If, If Else, Switch, Break, Continue
Chapter 4 Loop Control Statements in Java – For, While, Do While, Enhanched For Loop
Chapter 5 String Manipulation
Chapter 6 Difference between == and equals() method in Java
Chapter 7 Arrays in Java
Chapter 8 Access Modifiers in Java
Chapter 9 ArrayList in Java
Chapter 10 Methods in Java
Chapter 11 Method Overloading in Java
Chapter 12 Constructors in Java   
Chapter 13 This Keyword in Java   
Chapter 14 Static Keyword – Static Variable and Static Method in Java
Chapter 15 Difference between Static Method and Non-Static Method
Chapter 16 How to use Java Lambda expression to create thread via Runnable function
Chapter 17 runAsync and supplyAsync in ComputableFuture in Java8
Chapter 18 HashMap in Java
Chapter 19 Iterators in Java

OOPs Concepts

Chapter 1 Class and Object in Java
Chapter 2 Inheritance in Java
Chapter 3 Encapsulation in Java
Chapter 4 Polymorphism in Java
Chapter 5 Abstraction in Java
Chapter 6 Interface in Java
Chapter 7 Difference between Abstract Class and Interface

Exceptions in Java

Chapter 1 Exception Handling in Java
Chapter 2 Types of Exception in Java
Chapter 3 Flow control in try catch finally in Java
Chapter 4 Multiple Catch Exceptions
Chapter 5 Throw in Java
Chapter 6 Throws in Java

Data Handling (Excel Manipulation)

Chapter 1 How to download and install Apache POI
Chapter 2 How to read Excel in Java
Chapter 3 How to write data in Excel in Java
Chapter 4 How to update existing excel in Java
Chapter 5 How to add Formulas in Excel in Java

Multiple Choice Questions

Chapter 1 Multiple questions on Exception Handling in Java

Java Library

Chapter 1 AssertJ – Fluent Assertions in Java