net2020

Installing Eclipse Scala IDE on Linux

6/04/2014

Installing Eclipse Scala IDE on Linux

Prerequisites

Download the latest version of Scala IDE: Eclipse Scala IDE Find your OS (Linux), click on the link underneath it and choose Save File.

Unpack and install

Assuming archive name is scala-SDK-4.7.0-vfinal-2.12-linux.gtk.x86_64.tar.gz. You might need root access to perform installation. Move downloaded archive file to a shared folder (e.g. /opt/eclipse) and extract contents:

mkdir -p /opt/eclipse
mv /home/<user>/Downloads/scala-SDK-4.7.0-vfinal-2.12-linux.gtk.x86_64.tar.gz /opt/eclipse
cd /opt/eclipse
tar xf scala-SDK-4.7.0-vfinal-2.12-linux.gtk.x86_64.tar.gz
rm scala-SDK-4.7.0-vfinal-2.12-linux.gtk.x86_64.tar.gz
mv eclipse scala-sdk-4.7.0

At this point you should be able to run Eclipse Scala IDE with this command:

/opt/eclipse/scala-sdk-4.7.0/eclipse

If you run into permission issues you can change ownership of the folder with this command:

chown -R user.group /opt/eclipse/scala-sdk-4.7.0

Adding a desktop shortcut

If your desktop environment supports shortcuts you can add one for Scala IDE. Create new file in ~/Desktop folder called eclipseIde.desktop with these contents:

[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Name=Eclipse Scala IDE
Icon=/opt/eclipse/scala-sdk-4.7.0/icon.xpm
Name[en_US]=Eclipse Scala IDE
Icon[en_US]=/opt/eclipse/scala-sdk-4.7.0/icon.xpm
Exec=/opt/eclipse/scala-sdk-4.7.0/eclipse

Java Virtual Machine configuration

To use a different version of JVM open /opt/eclipse/scala-sdk-4.7.0/eclipse.ini in text editor and add or change these two lines:

-vm
/opt/jdk/jdk1.8/bin/java

Replace /opt/jdk/jdk1.8/bin/java with the path to your Java executable.

Memory configuration

If you feel like your Scala IDE is lagging you can give it more memory to work with. Open /opt/eclipse/scala-sdk-4.7.0/eclipse.ini in text editor and add or change these lines:

-Xmx4G
-Xms2G
-XX:MaxPermSize=1024m

Create new Scala project

To create new Scala project right click on empty space in Package Explorer window (on the left) and select New/Scala Project.

If you see messages about Scala library missing or having an incorrect version follow these steps:

  • right click on your Scala project and select Properties
  • select Java Build Path (on the left)
  • select Libraries (on the right) and scroll to the bottom
  • select Scala Library container and click Remove
  • click on Add Library, select Scala Library and click Next
  • select the correct version of Scala and click Finish