Intelli J Guide PDF

Title Intelli J Guide
Author Daniel Abad
Course Programming in the Large
Institution University of Queensland
Pages 7
File Size 499.9 KB
File Type PDF
Total Downloads 23
Total Views 181

Summary

guide...


Description

CSSE2002/7023 IntelliJ Guide Version 1.0.2 Written by Emily Bennett, Brae Webb & Richard Thomas

1

What is an IDE?

An IDE is an Integrated Development Environment. It is used by programmers to improve their efficiency in writing code by integrating commonly used tools into their text editor. A typical IDE will include text editing, syntax highlighting, code completion, and compiling and executing code as standard. The IDE we will be using in this course is IntelliJ IDEA, developed by JetBrains. This guide will walk you through the steps for getting started with IntelliJ.

2

Getting Started

2.1

Installation (personal computers only)

Lab computers should all have IntelliJ installed already, but you are welcome to install it on your personal machines as well. The steps to do so are as follows: • Nagivate to https://www.jetbrains.com/idea/ in a web browser • Click the Download button • Click the Download button for the Community Edition on the following page The IntelliJ installation file will now be downloaded. Follow the usual installation steps based on your operating system. Note that, as a student, you are able to get a student licence for all JetBrains products. This will allow you to install the Ultimate Edition of IntelliJ at no cost. While the Community Edition will be sufficient for this course, if you are interested in using the Ultimate Edition, you can read about applying for a student licence at https://www.jetbrains.com/student/.

1

CSSE2002/7023

2.2 2.2.1

IntelliJ

New Project First Time Opening the IDE

Opening IntelliJ IDEA for the first time will result in seeing a number of screens regarding importing existing IntelliJ settings (which can be skipped), agreeing to the JetBrains Privacy Policy, and sending usage statistics. After these initial steps, you should see the screen below. Pick either theme, although the Darcula theme is recommended, as it is likely to have less of an impact on your eyes, particularly if you are writing code for long periods of time. The Light theme will be used throughout this guide for ease of printing. Once you have selected a theme, click the Skip Remaining and Set Defaults button.

2.2.2

Setting Up the New Project

The next screen displayed is the welcome screen (yours may not have “(Administrator)” in the window title — this is also fine). This is where you pick what project you would like to open. Creating a new project will be demonstrated here, however for instructions on loading a project from version control (used in the assignments), refer to one of the SVN guides, either IntelliJ or command line, available on Blackboard. To create a blank new project, click on Create New Project.

Page 2

CSSE2002/7023

IntelliJ

Next we will need to tell IntelliJ which version of the Java Development Kit (JDK) to use to compile and run Java programs. In this course, we will be using JDK 13. The lab computers will already have JDK 13 installed, likely under C:\Program Files\Java\jdk-13.0.2. If you are using IntelliJ on a personal computer, you will need to install JDK 131 . Note that there is a difference between the JDK and the JRE (Java Runtime Environment) — writing and compiling code requires the JDK. Once you have installed/located your JDK, click the New... button, and navigate to its directory so that IntelliJ knows where to find it. After selecting your JDK, press Next, and then Next again (we don’t want to create a project from a template, so just ignore this).

1

This can be found on the JDK.Java downloads page — https://jdk.java.net/13/. It may have a later version of the JDK than 13.0.2.

Page 3

CSSE2002/7023

IntelliJ

The next screen is where you choose the location of your project. On a personal computer, this can be anywhere you like (although try to choose somewhere sensible so that you remember where to find it at a later stage). On the lab computers, it is important that you pick a location somewhere on your H:\ drive (rather than your C:\ drive) if you want your project to be permanently saved to your account and accessible from other lab computers.

If you are saving your project to an existing folder (for example, sample above), pressing Finish should be sufficient to complete the setup process for your new project. If you’d like to save it to a new folder without explicitly creating one yourself (say, for example, you want your project to be stored in sample\practicalX), simply add the desired project folder name (e.g. \practicalX) to the end of the Project location field (which should update the Project name field). When you press Finish, IntelliJ will remind you that this folder does not yet exist, and ask if you want it to be created. Pressing Yes should complete the process of setting up your project. Page 4

CSSE2002/7023

2.3

IntelliJ

New Class

At this point, you should see the following screen:

You now have a new project, however (as was covered in lectures), any code you write in Java will need to be contained within a class. We will thus now go over how to create a new class in IntelliJ. The first step will be to expand your project (in this case, sample) in the navigation panel on the left of the screen so that you can see the src folder. If your project has been set up correctly, this should be blue (this indicates to IntelliJ that it will find source code (.java) files in this folder). Right click on the src folder, click on New, and then Java Class. A dialog box should the pop up asking you to name your class. Enter a name (remembering to use the rules laid out in the Style Guide), and then press OK.

Page 5

CSSE2002/7023

IntelliJ

Upon pressing OK, your new class should open with a default class stub (class SampleExample {}), and you can now write code inside this class.

2.4

Compiling and Running

In order to run your code, you will need a main method (this is the entry point of Java code). Add a basic main method which prints out “Hello, World!” to your class in order to complete the following steps. You will find example code in the lecture slides. Once you’ve added a main method, you will notice that green play buttons (triangles) appear to the left of your code (an area called the gutter). There are many ways to compile and run your code in IntelliJ, however pressing one of these green play buttons is one of the quickest. Pressing this button, and then pressing Run ‘SampleExample.main()’ should compile and run your code, and you should see the output of your main method printed to the console (the window which should appear below your code).

Page 6

CSSE2002/7023

IntelliJ

Page 7...


Similar Free PDFs