此错误阻止我运行项目。
以下是版本信息:
~ ❯❯❯ java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
~ ❯❯❯ scala -version
cat: /release: No such file or directory
Scala code runner version 2.12.1 -- Copyright 2002-2016, LAMP/EPFL and Lightbend, Inc.
我使用IntelliJ 2016.3
在外部终端和sbt中,它可以工作!
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:483)
at sbt.compiler.RawCompiler.apply(RawCompiler.scala:26)
at sbt.compiler.AnalyzingCompiler$$anonfun$compileSources$1$$anonfun$apply$2.apply(AnalyzingCompiler.scala:146)
at sbt.compiler.AnalyzingCompiler$$anonfun$compileSources$1$$anonfun$apply$2.apply(AnalyzingCompiler.scala:142)
at sbt.IO$.withTemporaryDirectory(IO.scala:291)
at sbt.compiler.AnalyzingCompiler$$anonfun$compileSources$1.apply(AnalyzingCompiler.scala:142)
at sbt.compiler.AnalyzingCompiler$$anonfun$compileSources$1.apply(AnalyzingCompiler.scala:139)
at sbt.IO$.withTemporaryDirectory(IO.scala:291)
at sbt.compiler.AnalyzingCompiler$.compileSources(AnalyzingCompiler.scala:139)
at sbt.compiler.IC$.compileInterfaceJar(IncrementalCompiler.scala:52)
at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl$.org$jetbrains$jps$incremental$scala$local$CompilerFactoryImpl$$getOrCompileInterfaceJar(CompilerFactoryImpl.scala:93)
at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl$$anonfun$getScalac$1.apply(CompilerFactoryImpl.scala:50)
at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl$$anonfun$getScalac$1.apply(CompilerFactoryImpl.scala:49)
at scala.Option.map(Option.scala:146)
at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl.getScalac(CompilerFactoryImpl.scala:49)
at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl.createCompiler(CompilerFactoryImpl.scala:22)
at org.jetbrains.jps.incremental.scala.local.CachingFactory$$anonfun$createCompiler$1.apply(CachingFactory.scala:24)
at org.jetbrains.jps.incremental.scala.local.CachingFactory$$anonfun$createCompiler$1.apply(CachingFactory.scala:24)
at org.jetbrains.jps.incremental.scala.local.Cache$$anonfun$getOrUpdate$2.apply(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:23)
at org.jetbrains.jps.incremental.scala.local.LocalServer.compile(LocalServer.scala:22)
at org.jetbrains.jps.incremental.scala.remote.Main$.make(Main.scala:67)
at org.jetbrains.jps.incremental.scala.remote.Main$.nailMain(Main.scala:24)
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:483)
at com.martiansoftware.nailgun.NGSession.run(NGSession.java:319)
Caused by: java.lang.VerifyError: Uninitialized object exists on backward branch 209
Exception Details:
Location:
scala/collection/immutable/HashMap$HashTrieMap.split()Lscala/collection/immutable/Seq; @249: goto
Reason:
Error exists in the bytecode
Bytecode:
0000000: 2ab6 0057 04a0 001e b200 afb2 00b4 04bd
0000010: 0002 5903 2a53 c000 b6b6 00ba b600 bec0
0000020: 00c0 b02a b600 31b8 003b 3c1b 04a4 015e
0000030: 1b05 6c3d 2a1b 056c 2ab6 0031 b700 c23e
0000040: 2ab6 0031 021d 787e 3604 2ab6 0031 0210
0000050: 201d 647c 7e36 05bb 0014 59b2 00b4 2ab6
0000060: 0033 c000 b6b6 00c6 b700 c91c b600 cd3a
0000070: 0619 06c6 001a 1906 b600 d1c0 007d 3a07
0000080: 1906 b600 d4c0 007d 3a08 a700 0dbb 00d6
0000090: 5919 06b7 00d9 bf19 073a 0919 083a 0abb
00000a0: 0002 5915 0419 09bb 0014 59b2 00b4 1909
00000b0: c000 b6b6 00c6 b700 c903 b800 df3a 0e3a
00000c0: 0d03 190d b900 e301 0019 0e3a 1136 1036
00000d0: 0f15 0f15 109f 0027 150f 0460 1510 190d
00000e0: 150f b900 e602 00c0 0005 3a17 1911 1917
00000f0: b800 ea3a 1136 1036 0fa7 ffd8 1911 b800
0000100: eeb7 005c 3a0b bb00 0259 1505 190a bb00
0000110: 1459 b200 b419 0ac0 00b6 b600 c6b7 00c9
0000120: 03b8 00df 3a13 3a12 0319 12b9 00e3 0100
0000130: 1913 3a16 3615 3614 1514 1515 9f00 2715
0000140: 1404 6015 1519 1215 14b9 00e6 0200 c000
0000150: 053a 1819 1619 18b8 00f1 3a16 3615 3614
0000160: a7ff d819 16b8 00ee b700 5c3a 0cb2 00f6
0000170: b200 b405 bd00 0259 0319 0b53 5904 190c
0000180: 53c0 00b6 b600 bab6 00f9 b02a b600 3303
0000190: 32b6 00fb b0
Stackmap Table:
same_frame(@35)
full_frame(@141,{Object[#2],Integer,Integer,Integer,Integer,Integer,Object[#105]},{})
append_frame(@151,Object[#125],Object[#125])
full_frame(@209,{Object[#2],Integer,Integer,Integer,Integer,Integer,Object[#105],Object[#125],Object[#125],Object[#125],Object[#125],Top,Top,Object[#20],Object[#55],Integer,Integer,Object[#103]},{Uninitialized[#159],Uninitialized[#159],Integer,Object[#125]})
full_frame(@252,{Object[#2],Integer,Integer,Integer,Integer,Integer,Object[#105],Object[#125],Object[#125],Object[#125],Object[#125],Top,Top,Object[#20],Object[#55],Integer,Integer,Object[#103]},{Uninitialized[#159],Uninitialized[#159],Integer,Object[#125]})
full_frame(@312,{Object[#2],Integer,Integer,Integer,Integer,Integer,Object[#105],Object[#125],Object[#125],Object[#125],Object[#125],Object[#2],Top,Object[#20],Object[#55],Integer,Integer,Object[#103],Object[#20],Object[#55],Integer,Integer,Object[#103]},{Uninitialized[#262],Uninitialized[#262],Integer,Object[#125]})
full_frame(@355,{Object[#2],Integer,Integer,Integer,Integer,Integer,Object[#105],Object[#125],Object[#125],Object[#125],Object[#125],Object[#2],Top,Object[#20],Object[#55],Integer,Integer,Object[#103],Object[#20],Object[#55],Integer,Integer,Object[#103]},{Uninitialized[#262],Uninitialized[#262],Integer,Object[#125]})
full_frame(@395,{Object[#2],Integer},{})
at scala.collection.immutable.HashMap$.scala$collection$immutable$HashMap$$makeHashTrieMap(HashMap.scala:179)
at scala.collection.immutable.HashMap$.scala$collection$immutable$HashMap$$makeHashTrieMap(HashMap.scala:183)
at scala.collection.immutable.HashMap$HashMap1.updated0(HashMap.scala:211)
at scala.collection.immutable.HashMap.$plus(HashMap.scala:59)
at scala.collection.immutable.HashMap.$plus(HashMap.scala:62)
at scala.collection.immutable.Map$Map4.updated(Map.scala:201)
at scala.collection.immutable.Map$Map4.$plus(Map.scala:202)
at scala.collection.immutable.Map$Map4.$plus(Map.scala:180)
at scala.collection.mutable.MapBuilder.$plus$eq(MapBuilder.scala:29)
at scala.collection.mutable.MapBuilder.$plus$eq(MapBuilder.scala:25)
at scala.collection.generic.Growable.$anonfun$$plus$plus$eq$1(Growable.scala:59)
at scala.collection.generic.Growable$$Lambda$19/1738535896.apply(Unknown Source)
at scala.collection.mutable.ResizableArray.foreach(ResizableArray.scala:59)
at scala.collection.mutable.ResizableArray.foreach$(ResizableArray.scala:52)
at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48)
at scala.collection.generic.Growable.$plus$plus$eq(Growable.scala:59)
at scala.collection.generic.Growable.$plus$plus$eq$(Growable.scala:50)
at scala.collection.mutable.MapBuilder.$plus$plus$eq(MapBuilder.scala:25)
at scala.collection.generic.GenMapFactory.apply(GenMapFactory.scala:48)
at scala.sys.package$.env(package.scala:61)
at scala.tools.nsc.settings.ScalaSettings.defaultClasspath(ScalaSettings.scala:30)
at scala.tools.nsc.settings.ScalaSettings.defaultClasspath$(ScalaSettings.scala:30)
at scala.tools.nsc.settings.MutableSettings.defaultClasspath(MutableSettings.scala:19)
at scala.tools.nsc.settings.ScalaSettings.$init$(ScalaSettings.scala:57)
at scala.tools.nsc.settings.MutableSettings.<init>(MutableSettings.scala:20)
at scala.tools.nsc.Settings.<init>(Settings.scala:12)
at scala.tools.nsc.Driver.process(Driver.scala:41)
at scala.tools.nsc.Main.process(Main.scala)
... 34 more
答案 0 :(得分:8)
This question让我走上正轨
所以我查看了JDK版本,令人惊讶的是IntelliJ和Nailgun并没有使用相同的JDK。
~ ❯❯❯ ps -ef | grep java
501 2290 2017 0 4:12PM ?? 0:01.81 /Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home/bin/java … org.jetbrains.plugins.scala.nailgun.NailgunRunner 3200 6a73f540-1a80-476d-96d2-83ab8faaad95
501 2291 2017 0 4:12PM ?? 0:02.15 /Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home/bin/java …
所以我在IntelliJ首选项中搜索并发现 Scala编译服务器配置了旧的JDK:1.8.0_11。 Bim!
我刚刚取消选中复选框使用外部编译服务器
答案 1 :(得分:0)
请注意,在scala-2.12中,scala二进制文件是一个包装脚本。
看起来您的JAVA_HOME目录未正确设置。
看一下读取的行(在$ SCALA_HOME / bin / scala中):
java_release="$(cat $JAVA_HOME/release | grep JAVA_VERSION)"
根据您的输出,看起来没有设置JAVA_HOME。你得到的是:
cat: /release: No such file or directory
答案 2 :(得分:0)
在intellij中编辑配置,然后在JRE中选择下拉系统中安装的jdk版本。并进行重建,它对我有用。