Scala 安装 Exception in thread "main" java.lang.VerifyError: Uninitialized object exists on backward branch 96
windows下载安装完最新版本的Scala(2.12.4)后,终端如下错误
C:\Users\Administrator>scala -version
Exception in thread "main" java.lang.VerifyError: Uninitialized object exists on backward branch 96
Exception Details:
Location:
scala/tools/nsc/CompilerCommand.sstring$1(Ljava/lang/String;Lscala/collection/immutable/List;I)L
scala/Option; @153: goto
Reason:
Error exists in the bytecode
Bytecode:
0000000: 2bb6 02ec 9900 07b2 016a b0bb 0154 591c
0000010: ba02 f200 00b2 00c9 b600 cd3a 044e 1904
0000020: b200 c9b6 00d1 a600 7d2b b200 d6a6 000b
0000030: b200 d63a 09a7 0077 bb00 d859 2bb6 00db
0000040: c000 2b3a 0a1c 190a b802 eeb2 00d6 b700
0000050: e83a 0519 053a 062b b600 ebc0 0050 3a07
0000060: 1907 b200 d6a5 0037 bb00 d859 1907 b600
0000070: dbc0 002b 3a0a 1c19 0ab8 02ee b200 d6b7
0000080: 00e8 3a08 1906 1908 b600 ef19 083a 0619
0000090: 07b6 00eb c000 503a 07a7 ffc7 1905 3a09
00000a0: a700 0c2b 2d19 04b8 00f5 3a09 1909 c000
00000b0: 502a b602 f613 02f8 b602 04b7 0159 b0
Stackmap Table:
same_frame(@11)
full_frame(@56,{Object[#118],Object[#80],Integer,Object[#333],Object[#335]},{Uninitialized[#11],
Uninitialized[#11]})
full_frame(@96,{Object[#118],Object[#80],Integer,Object[#333],Object[#335],Object[#216],Object[#
216],Object[#80],Top,Top,Object[#43]},{Uninitialized[#11],Uninitialized[#11]})
full_frame(@156,{Object[#118],Object[#80],Integer,Object[#333],Object[#335],Object[#216],Object[
#216],Object[#80],Top,Top,Object[#43]},{Uninitialized[#11],Uninitialized[#11]})
full_frame(@163,{Object[#118],Object[#80],Integer,Object[#333],Object[#335]},{Uninitialized[#11]
,Uninitialized[#11]})
full_frame(@172,{Object[#118],Object[#80],Integer,Object[#333],Object[#335],Top,Top,Top,Top,Obje
ct[#4]},{Uninitialized[#11],Uninitialized[#11]})
at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:42)
at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:101)
at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
网上找了一圈,发现是JDK版本的问题,原先的版本如下
C:\Users\Administrator>java -version
java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)
升级版本后,解决问题(升级到jdk8 131或者151均可)
C:\Users\Administrator>java -version
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)
C:\Users\Administrator>scala -version
Scala code runner version 2.12.4 -- Copyright 2002-2017, LAMP/EPFL and Lightbend, Inc.