Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

NOTE: This page is for an old offering of the course. To find the latest course offering, please visit https://comp311.rice.edu/.

Adapted from Professor Wallach's Comp 215 instructions for installing IntelliJ IDEA with Java 8.

flat
Table of Contents
type

This document walks through all the necessary steps to install IntelliJ properly, including the necessary libraries and plugins to use is with Scala.

...

Visit the IntellJ IDEA download site
https://www.jetbrains.com/idea/download/

and download the free ``community edition''. (There's nothing in the ``ultimate'' edition that will make any difference to your work in Comp215, Comp322, Comp311, or (hopefully) most other undergraduate computer science courses.)  Versions are available for Windows, Mac OS X, and Linux. IntelliJ is an example of an integrated development environment (IDE). The other popular Java IDE you may have heard of or used in the past is Eclipse.


If this is the first time you have installed IntelliJ IDEA on your computer, the software will ask you to customize it a bit before starting. You can pick a color scheme that you like, then it will ask you to customize different plugins. Go through these pages and follow these instuctionsinstructions:

  • On the page "Tune IDEA to your tasks" click on "customize" for "Test Tools".   You should see that JUnit is automatically installed.  Click on "Save Changes and Go Back".
  • When  you get to the page "Download featured plugins" you will see a column  for Scala. Click on "Install" for that plugin. The Scala plugin will  install (this should take less than a minute on a reasonably  responsive  network).

...

You will now have a new project with no open files. To create your first Scala file:

  • On the left-hand side of the screen, below the word "Project" you will see a list of directories in a tree view. The first directory should have the same name as your project. Open this directory.
  • Right click on the subdirectory src.
  • Navigate to the New option and select File
    • Warning: If you select Scala Class, IntelliJ will create an ordinary class, not a case class for you. Be sure to edit the source code it creates accordingly.
  • You will be prompted for a file name. Name it  your-file-name.scala
  • You can now enter source code for your program in this file

...

  • Place the cursor over the declared name of the class in the source file for the class
  • Select Navigate → Test → Create New Test
  • A dialog box will pop up. Select JUnit 4.
  • Directly beneath your selection, you will see an error message: JUnit 4 library not found in the module. Sigh and click Fix. (Amazingly, this seems to be the easiest way to import JUnit into your project.)
  • Click Ok.
  • Bizarrely, this procedure will produce a Java source file, not a Scala one. Select Refactor → Rename File, and rename the file to have a .scala suffix.
  • Delete the auto-generated Java code in your test file and replace it with this template:

...

  • You can now fill this test class in with your test methods as discussed in class.

Running Tests

To run Run your tests in IDEA as follows:

...