Nan Xiao's Blog

A system software / performance engineer's home

Getting Started with Scala in IntelliJ IDEA 14.1

This tutorial uses IntelliJ IDEA 14.1.3 version.

Prerequisites:

You should install Java and Scala first.

(1) Install Scala plugin:

a) After installing IntelliJ IDEA successfully, we need to install Scala plugin first: In the welcome window, select Configure -> Plugins:  

0

b) Select “Install JetBrains Plugin...“:

2c) If your computer needs proxy, please click “HTTP Proxy Settings” to configure proxy, else ignore it:

3

 

d) Select Scala plugin, and click Install plugin to install it:

4

 

The installing progress is like this:

5

e) After installation, restart IntelliJ IDEA:

6

 

 

 

(2) Create Scala project:
a) Select “Create New Project:

11

b) Select “Scala” -> “Scala“, then click Next:

7

c) Select a valid name for project and a folder to store project files:

12

d) Fill Project SDK with JDK directory:

13

After selection, click “OK:

14

e) For Scala SDK, click “Create“. It will display the installed Scala, click “OK“:

15

f) Click “Finish“:

16

(3) Create Scala application:

a) Select src -> New -> Scala Class:

17

b) Select object as Kind value:

18

c) Write a simple “Hello World” program:

19

d) Select Run -> Run:

20

e) Select HelloWorld:

21

f) The application outputs “Hello World!“:

22

All is OK now!

 

 

Previous

How to organize a successful technical party?

Next

Build Apache Spark Application in IntelliJ IDEA 14.1

7 Comments

  1. Martin

    thanks – got me up and running

  2. neera singh

    Thanks a ton for this description.. It is so helpful for the beginners

  3. Ildar

    Thanks a lot)

  4. Praveen Mourya

    hi All,
    I followed your scenario, but I am getting error which is:
    \\
    com.intellij.diagnostic.PluginException: Bad type on operand stack
    Exception Details:
    Location:
    com/googlecode/sca4idea/SCAProjectComponent.(Lcom/intellij/openapi/project/Project;)V @18: invokespecial
    Reason:
    Type ‘com/intellij/psi/impl/source/resolve/reference/ReferenceProvidersRegistry’ (current frame, stack[3]) is not assignable to ‘com/intellij/psi/PsiReferenceRegistrar’
    Current Frame:
    bci: @18
    flags: { }
    locals: { ‘com/googlecode/sca4idea/SCAProjectComponent’, ‘com/intellij/openapi/project/Project’ }
    stack: { ‘com/googlecode/sca4idea/SCAProjectComponent’, uninitialized 10, uninitialized 10, ‘com/intellij/psi/impl/source/resolve/reference/ReferenceProvidersRegistry’ }
    Bytecode:
    0x0000000: 2ab7 0010 2a2b b500 122a bb00 1459 2bb8
    0x0000010: 001a b700 1db5 001f b1
    [Plugin: SCA Support]
    \\

    I am not able to under stand this.
    Your help would be much appreciated.

    • nanxiao

      It seems this issue is related to IntelliJ plugin, maybe you may try to get help from IntelliJ team, thanks!

  5. Shailesh

    Very much useful for newbies, thank you so much..

  6. Vineet

    Very helpful indeed foe beginners. I spent hours at other websites just to get this kind of a kick start.
    Good that someone has put it so nicely here.

Leave a Reply

Powered by WordPress & Theme by Anders Norén