JDK 1.8 - can't with import sbt project - scala

I have some trouble after installing java 1.8 on Ubuntu Gnome 14.04 with Intellij Idea 13.1.
When I tried to import sbt project it throws next:
I tried to install and set up java 1.7 at .pam-environment. But it keep taking 1.8 as main configuration and throwing this warning. I solved it by completely delete 1.8 version.
Version of scala:
nazar#lelyak-desktop:~⟫ scala -version
Scala code runner version 2.10.4 -- Copyright 2002-2013, LAMP/EPFL
And sbt - 0.13.1
I wondering to know how to use sbt with JDK 1.8?
Or with let sbt to use 1.7 version when 1.8 is default.
SOLUTION:
I changed configuration at settings for sbt to custom JDK - 1.7 and sbt-launch.jar - have installed by me.

The reason for the warning/error is that in Java 8 the permanent generation was removed.
You can change settings in IntelliJ idea not to add -XX:MaxPermSize. Go to settings page and click edit next to VM Parameters.
Remove parameter called -XX:MaxPermSize.

Related

Scala not builds on Java 10

while building through Intellij Idea, I got the following message:
Error:scalac: 'jvm-1.10' is not a valid choice for '-target'
Error:scalac: bad option: '-target:jvm-1.10'
later, after a Java upgrade
Build, Execution, Deployment -> Build Tools -> Gradle -> Gradle JVM:
1.8 Build, Execution, Deployment -> Complier -> Scala Complier -> Scala Compile Server -> JDK: 1.8
in build.gradle
compileScala.targetCompatibility = 1.8
ScalaCompileOptions.metaClass.useAnt = false
Nothing helps!
upd:
this helps: in build.gradle
tasks.withType(ScalaCompile) {
scalaCompileOptions.useAnt = false
}
not needed:
compileScala.targetCompatibility = 1.8
ScalaCompileOptions.metaClass.useAnt = false
"Error:scalac: 'jvm-1.10' is not a valid choice for '-target' Error:scalac: bad option: '-target:jvm-1.10'"
In the JDK compatibility notes as mentioned below, it also indicates
that the Java 10 is not fully supporting Scala 2.12.6 JDK 9 & 10
compatibility notes
As you were saying you build this through IntelliJ IDEA, I suspect
you haven't configure your java version (Java 10) or scala version
(2.12.6) inside running configuration project settings.
And also please try out building/compile your application through
commandline in order to check whether you are getting the same error
with that (Otherwise this is just bad configuration in IDEA tht you
need to change)
JDK 9 & 10 compatibility notes (Mentioned in Scala Docs)
JDK 9 & 10 compatibility notes
As of Scala 2.12.6 and 2.11.12, JDK 9 & 10 support is incomplete. Notably, scalac will not enforce the restrictions of the Java Platform Module System, which means that code that typechecks may incur linkage errors at runtime.
JDK 9 & 10 support requires minimum sbt version 1.1.0, or 0.13.17 in the 0.13.x series.
For more information on JDK 9 & 10 compatibility, watch the “Support JDK 9” issue on GitHub.
The same issue can happen with mixed multi-module gradle projects that use java 11 and scala 2.12.10.
In that case, it may help to reconfigure IntelliJ (2019.2) via
Settings > Build, Execution, Deployment > Scala Compiler
by removing the targets defined in Additional compiler options for the affected scala modules.
I stumbled over this issue when having the same problem with Java 11. The reconfiguration comment of Roland Ewald solved the problem. It is important to mention, that this reconfiguration has to be made for all modules of the project (at least for me this was necessary) as well as that IntelliJ sometimes hides parts of the Additional compiler options, so be sure to click on expand even if they seem empty or correct.

install scala 2.10.4 plugin on scalaide

I installed scalaIDE on ubuntu. as installed, it has both scala 2.11.6 and 2.10.5 build in. The version I need is 2.10.4. How do I add that version into scalaIDE?
Window -> Preferences -> Scala -> Installations
Click Add. Probably you will already have the version of scala you need in ~/.sbt/boot. Just choose, name it and click Ok.
Reference: BYOS (Bring Your Own Scala)

SBT project in IDEA 14 does not work on Ubuntu

My SBT project imports itself perfectly to IDEA IDE on MacOS, but on the Ubuntu it shows dozens of errors about not being able to resolve symbols.
for example:
import play.api.mvc.Action
reports Unused import statement from withing IDEA
and reference to Action several lines afterwards is reported as Cannot resolve method Action.apply
The problem is only to be seen in the IDE as sbt run from the command line is perfectly ok.
My current version of the IntelliJ IDEA IDE is 14 Ultimate
Scala plugin version 1.2.1
SBT version on the Ubuntu host 0.13.7
JDK version Oracle JDK 1.8.0_25
I had the same problem (running Fedora 20). Try with the EAP version of Intellij IDEA 14 (see : https://confluence.jetbrains.com/display/IDEADEV/IDEA+14+EAP).
Also, you have to use the EAP version of the Scala plugin (parameters > Frameworks and Languages > Scala > Misc).
It worked for me.

Playframework 2.3.6 reactive-stocks-java8 template issue in eclipse Luna

I have a problem using Eclipse as IDE for the reactive-stocks-java8 template coming with typesafe-activator-1.2.10
Here are my steps:
Install Eclipse Luna on my Mac.
Default JRE is 1.6, but I have the oracle JDK in /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/ after installing with the standard method. I add this JRE to the alternate JRE of eclipse
Install activator
I've downloaded typesafe-activator-1.2.10.zip, unzip it in a folder, add it to the path to have activator in the command line.
Create the project
$activator new
> reactive-stocks-java8
$cd reactive-stocks-java8/
$java -version
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
$activator
[reactive-stocks-java8] $eclipse with-source=true
In eclipse
I import the project in the standard way (Import / Existing Project into Workspace)
in the java build path, The JRE is the 1.6. I change it to 1.8.0_25
I also have to change the java compiler
In my package explorer or the Problems view, no compilation error, great. Now I click on app/controller/Application.java to open it in the editor. In the editor, I've got some unresolved:
views.html.index cannot be resolved to a type
The type scala.collection.Seq cannot be resolved. It is indirectly referenced from required .class files
What am I missing?
here are the answers from the community
https://groups.google.com/forum/#!topic/play-framework/v6ep7DmfH18

Is there a ScalaTest Plugin for Eclipse Luna and Scala IDE Lithium?

Trying to find the ScalaTest plugin for use with Eclipse Luna and Scala IDE for Eclipse 4.0.0 (aka Lithium). Currently using Milestone 2 of the Scala IDE for Eclipse Lithium plugin.
The ScalaTest plugin used to be part of the Scala IDE for Eclipse plugin (appeared on the list and you could check the box it to install--Scala IDE for Eclipse is supposed to be an ecosystem of plugins, ScalaTest being one of them). It doesn't appear to be there any more.
It's not on the list,
When I check "Installation Details" it doesn't appear either, and
Test configurations don't appear under "Run As..."
But there is mention of Luna in the ScalaTest plugin Github site for the scalatest plugin (https://github.com/scalatest/scalatest-eclipse-plugin), which is supposed to be part of the Scala IDE for Eclipse ecosystem.
The tests run fine from the SBT command line. So I know the ScalaTest jar file is in the classpath and is of a compatible version for my project. The ScalaTest jar file appears as an external jar file in my project in Eclipse, and the tests compile in Eclipse. Other Scala IDE for Eclipse functions seem to work correctly.
System Configuration:
Eclipse Version: Luna (4.4.0),
Scala IDE for Eclipse Version: Lithium 4.0.0 Milestone 2, for Luna and Scala 2.11.1 (download site http://download.scala-ide.org/sdk/lithium/e44/scala211/dev/site)
Java Version: Java 1.8_05,
Scala Version: 2.11.1,
Build Tool: SBT 0.13.5, running under Java 1.8_05,
ScalaTest Version: scalatest_2.11-2.2.0.jar (copied into the lib directory of my project)
My Eclipse project file is generated by SBT using the eclipse SBT command, and loaded into Eclipse using the standard "Import->Existing Projects Into Workspace..." method. The build.sbt file is a single line reading scalaVersion := "2.11.1".
Is there a ScalaTest plugin for Eclipse Luna and Scala IDE for Eclipse 4.0 (Lithium)? If so, where do I go about finding it?
This is a version of the Scala IDE that works with Eclipse Luna (version 4.4).
http://download.scala-ide.org/sdk/lithium/e44/scala211/dev/site