gpt4 book ai didi

java - Scala 无法在 IntelliJ 中运行

转载 作者:行者123 更新时间:2023-11-30 10:13:42 26 4
gpt4 key购买 nike

当我尝试在 intillij 中运行任何 scala 代码时,出现以下错误:

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)

我正在运行最新版本的 intellij 和 scala,都在 ubuntu 18 中。

但是,当我在终端中运行 scala 并输入代码时,它会起作用。

最佳答案

很可能您使用的是不兼容的 java 和 scala 版本。参见 https://docs.scala-lang.org/overviews/jdk-compatibility/overview.html

关于java - Scala 无法在 IntelliJ 中运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51221804/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com