From the course: IntelliJ IDEA Community Edition Essential Training

Create a new Java project

From the course: IntelliJ IDEA Community Edition Essential Training

Start my 1-month free trial

Create a new Java project

- After installing and configuring IntelliJ IDEA, and installing a copy of the JDK, you're ready to create a project. From the welcome screen, I'll select New Project. On the left, you can decide what kind of project you're creating. You can choose a primary programming language, such as Java, Groovy or Kotlin. You can also choose one of the available frameworks for managing dependencies. Dependencies are links to external libraries. Maven and Gradle are two frameworks for working with libraries that are managed in repositories. For this first project, I'm going to create the ultimately simple application, a Hello World application, written in Java. You can also choose which SDK you want to use. And in the previous video I showed you that you can use versions of the JDK either from the root directory or from the home directory. I'm going to stick with the open JDK version that I just downloaded and click Next. For Java projects you can choose to create a project from a template called the Command Line App, and I'll choose that. Then I'll click Next. And I call this project Hello World. Now you can name the project anything you want, but the location directory shouldn't ever have spaces in it, so I'll get rid of the spaces. And you can also set the base package in Java, that means you're saying where you want your code files to go, and also how you're going to access them from other code in your project. I'm going to call my base package com.example, and then I'll click Finish. And I'm told that the project directory idea projects doesn't exist. So it has to be created. So I'll click the Create button. And that creates the project, and the folder where it's stored. The first time you open the entire user interface, you'll see the Tip of the Day dialog. You can click Next Tip, and next and next again to see all kinds of good information, but if you don't want that to happen in the future, check this option and close the window. The first thing I noticed is that the text is pretty small. On Mac I'll go to IntelliJ IDEA and choose Preferences and on Windows, I would go to the File menu and choose settings. And from there, I'll click on Editor. I'll click on Font. And al change the size of my font from 13 to 14 make it a little bit bigger. Then I'll run the application by clicking this Run Main button up here. And down here you'll see a couple of notifications indicating that the project is being built. And then you'll see a bit of output indicating that something happened. Now, this code isn't doing anything yet. So I'll go back to my code up here. And I'm going to add a new line and type S O U T. This is a shortcut, or something called a template that expands when you press the Tab key to complete code. It expands to System.out.println, which is how you print a line of code in the console. Then al add a string, that's wrapped in double quotes. And then I'll run the code again. And down at the bottom after a moment, I see the output of my simple application saying Hello World. So if you've gotten this far, you've correctly configured IntelliJ IDEA with the copy of the JDK, you've written some valid Java code, and you've executed it. And now you'll be able to add whatever components you need to build your software.

Contents