Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you use external Scala compiler with IDEA 12?

How do you use external Scala compiler with IDEA ? I seem to have randomly appearing errors saying "scala: Cannot connect to compile server at localhost/127.0.0.1:3200"

Sometimes it works. Sometimes it doesn't. I can't find the pattern.

Here is what I have in the log

9:20:58 PM Auto make completed with errors
9:21:09 PM Using a new (SBT-based) Scala compiler.
           In case of any compilation problems you may enable the previous (internal) compiler by clearing:
           Project Settings / Compiler / Use external build
9:21:10 PM Scala compile server
           Error: Could not create the Java Virtual Machine.
           Error: A fatal exception has occurred. Program will exit.

9:21:12 PM Compilation completed with 1 error and 0 warnings in 3 sec

I'm using

  • IDEA 12.1 (129.161)
  • Scala compiler 2.10.1
  • Scala plugin 0.7.213
  • JDK 1.7
  • Windows 7

In Project Settings / Compiler / Use external build is checked. In IDE Settings / Scala / Run compile server is checked.

Do I need to launch compiler server manually ? Anything else ?

UPD: Looks like bug to me. I posted JIRA ticket http://youtrack.jetbrains.com/issue/SCL-5523

like image 600
expert Avatar asked Apr 05 '13 04:04

expert


People also ask

How does the Scala compiler work?

Scala has both a compiler and an interpreter which can execute Scala code. The Scala compiler compiles your Scala code into Java Byte Code which can then be executed by the scala command. The scala command is similar to the java command, in that it executes your compiled Scala code.

How do I select Scala version in IntelliJ?

Press Ctrl+Alt+S to open Settings/Preferences dialog. From the options on the left, select Build, Execution, Deployment | Compiler | Scala | Scala Compiler Server.

How do I open a Scala project in IntelliJ?

Press Ctrl+Alt+S to open the IDE settings and select Build, Execution, Deployment | Build Tools | sbt. In the sbt projects section, select a project for which you want to configure build actions. In the sbt shell section, select the builds option. Click OK to save the changes.


2 Answers

You need to lower the heap size from 1024 to 512 or something. Then the compile server can be created and started. Tried with the InteliJ 13.0.2 (133.331) and Scala plugin 0.26.361

like image 129
imgen Avatar answered Sep 30 '22 17:09

imgen


Go to Settings -> Compiler and uncheck "Use external build"

like image 32
Rotem Avatar answered Sep 30 '22 19:09

Rotem