title: Scala won't run in IntelliJ
body: <p>When I try to run any scala code in intillij, I get the following error:</p>
  
  <blockquote>
    <p>Information:07/07/18 10:20 - Compilation completed with 1 error and 1 warning in 3 s 617 ms
        Error:scalac: Error: org.jetbrains.jps.incremental.scala.remote.ServerException
        java.lang.reflect.InvocationTargetException
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            at sbt.internal.inc.RawCompiler.getReporter$1(RawCompiler.scala:50)
            at sbt.internal.inc.RawCompiler.apply(RawCompiler.scala:71)
            at sbt.internal.inc.AnalyzingCompiler$.$anonfun$compileSources$6(AnalyzingCompiler.scala:350)
            at sbt.internal.inc.AnalyzingCompiler$.handleCompilationError$1(AnalyzingCompiler.scala:327)
            at sbt.internal.inc.AnalyzingCompiler$.$anonfun$compileSources$4(AnalyzingCompiler.scala:346)
            at sbt.internal.inc.AnalyzingCompiler$.$anonfun$compileSources$4$adapted(AnalyzingCompiler.scala:341)
            at sbt.io.IO$.withTemporaryDirectory(IO.scala:376)
            at sbt.io.IO$.withTemporaryDirectory(IO.scala:383)
            at sbt.internal.inc.AnalyzingCompiler$.$anonfun$compileSources$2(AnalyzingCompiler.scala:341)
            at sbt.internal.inc.AnalyzingCompiler$.$anonfun$compileSources$2$adapted(AnalyzingCompiler.scala:335)
            at sbt.io.IO$.withTemporaryDirectory(IO.scala:376)
            at sbt.io.IO$.withTemporaryDirectory(IO.scala:383)
            at sbt.internal.inc.AnalyzingCompiler$.compileSources(AnalyzingCompiler.scala:335)
            at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl$.getOrCompileInterfaceJar(CompilerFactoryImpl.scala:128)
            at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl.$anonfun$getScalac$1(CompilerFactoryImpl.scala:49)
            at scala.Option.map(Option.scala:146)
            at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl.getScalac(CompilerFactoryImpl.scala:47)
            at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl.createCompiler(CompilerFactoryImpl.scala:25)
            at org.jetbrains.jps.incremental.scala.local.CachingFactory.$anonfun$createCompiler$3(CachingFactory.scala:24)
            at org.jetbrains.jps.incremental.scala.local.Cache.$anonfun$getOrUpdate$2(Cache.scala:20)
            at scala.Option.getOrElse(Option.scala:121)
            at org.jetbrains.jps.incremental.scala.local.Cache.getOrUpdate(Cache.scala:19)
            at org.jetbrains.jps.incremental.scala.local.CachingFactory.createCompiler(CachingFactory.scala:24)
            at org.jetbrains.jps.incremental.scala.local.LocalServer.compile(LocalServer.scala:22)
            at org.jetbrains.jps.incremental.scala.remote.Main$.make(Main.scala:83)
            at org.jetbrains.jps.incremental.scala.remote.Main$.nailMain(Main.scala:26)
            at org.jetbrains.jps.incremental.scala.remote.Main.nailMain(Main.scala)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            at com.martiansoftware.nailgun.NGSession.run(NGSession.java:319)
        Caused by: java.lang.NoSuchMethodError: java.nio.ByteBuffer.clear()Ljava/nio/ByteBuffer;
            at scala.tools.nsc.io.SourceReader.read(SourceReader.scala:61)
            at scala.tools.nsc.io.SourceReader.read(SourceReader.scala:40)
            at scala.tools.nsc.io.SourceReader.read(SourceReader.scala:49)
            at scala.tools.nsc.Global.getSourceFile(Global.scala:395)
            at scala.tools.nsc.Global.getSourceFile(Global.scala:401)
            at scala.tools.nsc.Global$Run$$anonfun$30.apply(Global.scala:1607)
            at scala.tools.nsc.Global$Run$$anonfun$30.apply(Global.scala:1607)
            at scala.collection.immutable.List.map(List.scala:284)
            at scala.tools.nsc.Global$Run.compile(Global.scala:1607)
            at scala.tools.nsc.Driver.doCompile(Driver.scala:32)
            at scala.tools.nsc.MainClass.doCompile(Main.scala:23)
            at scala.tools.nsc.Driver.process(Driver.scala:51)
            at scala.tools.nsc.Main.process(Main.scala)
            ... 36 more
        Warning:scalac: error: java.lang.NoSuchMethodError: java.nio.ByteBuffer.clear()Ljava/nio/ByteBuffer;
            at scala.tools.nsc.io.SourceReader.read(SourceReader.scala:61)
            at scala.tools.nsc.io.SourceReader.read(SourceReader.scala:40)
            at scala.tools.nsc.io.SourceReader.read(SourceReader.scala:49)
            at scala.tools.nsc.Global.getSourceFile(Global.scala:395)
            at scala.tools.nsc.Global.getSourceFile(Global.scala:401)
            at scala.tools.nsc.Global$Run$$anonfun$30.apply(Global.scala:1607)
            at scala.tools.nsc.Global$Run$$anonfun$30.apply(Global.scala:1607)
            at scala.collection.immutable.List.map(List.scala:284)
            at scala.tools.nsc.Global$Run.compile(Global.scala:1607)
            at scala.tools.nsc.Driver.doCompile(Driver.scala:32)
            at scala.tools.nsc.MainClass.doCompile(Main.scala:23)
            at scala.tools.nsc.Driver.process(Driver.scala:51)
            at scala.tools.nsc.Main.process(Main.scala)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            at sbt.internal.inc.RawCompiler.getReporter$1(RawCompiler.scala:50)
            at sbt.internal.inc.RawCompiler.apply(RawCompiler.scala:71)
            at sbt.internal.inc.AnalyzingCompiler$.$anonfun$compileSources$6(AnalyzingCompiler.scala:350)
            at sbt.internal.inc.AnalyzingCompiler$.handleCompilationError$1(AnalyzingCompiler.scala:327)
            at sbt.internal.inc.AnalyzingCompiler$.$anonfun$compileSources$4(AnalyzingCompiler.scala:346)
            at sbt.internal.inc.AnalyzingCompiler$.$anonfun$compileSources$4$adapted(AnalyzingCompiler.scala:341)
            at sbt.io.IO$.withTemporaryDirectory(IO.scala:376)
            at sbt.io.IO$.withTemporaryDirectory(IO.scala:383)
            at sbt.internal.inc.AnalyzingCompiler$.$anonfun$compileSources$2(AnalyzingCompiler.scala:341)
            at sbt.internal.inc.AnalyzingCompiler$.$anonfun$compileSources$2$adapted(AnalyzingCompiler.scala:335)
            at sbt.io.IO$.withTemporaryDirectory(IO.scala:376)
            at sbt.io.IO$.withTemporaryDirectory(IO.scala:383)
            at sbt.internal.inc.AnalyzingCompiler$.compileSources(AnalyzingCompiler.scala:335)
            at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl$.getOrCompileInterfaceJar(CompilerFactoryImpl.scala:128)
            at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl.$anonfun$getScalac$1(CompilerFactoryImpl.scala:49)
            at scala.Option.map(Option.scala:146)
            at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl.getScalac(CompilerFactoryImpl.scala:47)
            at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl.createCompiler(CompilerFactoryImpl.scala:25)
            at org.jetbrains.jps.incremental.scala.local.CachingFactory.$anonfun$createCompiler$3(CachingFactory.scala:24)
            at org.jetbrains.jps.incremental.scala.local.Cache.$anonfun$getOrUpdate$2(Cache.scala:20)
            at scala.Option.getOrElse(Option.scala:121)
            at org.jetbrains.jps.incremental.scala.local.Cache.getOrUpdate(Cache.scala:19)
            at org.jetbrains.jps.incremental.scala.local.CachingFactory.createCompiler(CachingFactory.scala:24)
            at org.jetbrains.jps.incremental.scala.local.LocalServer.compile(LocalServer.scala:22)
            at org.jetbrains.jps.incremental.scala.remote.Main$.make(Main.scala:83)
            at org.jetbrains.jps.incremental.scala.remote.Main$.nailMain(Main.scala:26)
            at org.jetbrains.jps.incremental.scala.remote.Main.nailMain(Main.scala)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            at com.martiansoftware.nailgun.NGSession.run(NGSession.java:319)</p>
  </blockquote>
  
  <p>I am running the latest version of intellij and scala, all in ubuntu 18.</p>
  
  <p>It works however when I run scala in the terminal and type in code.</p>