scala 2.9.2 & Oracle Java compatability
Currently the documentation on scala site reads scala 2.9.2 needs Java 1.6 or higher. But I see that only Oracle Java 1.6 and 1.7 is working out-of-the-box with scala 2.9.2.
Case 1:
While trying to setup scala 2.9.2 on Ubuntu 15.04 using Oracle Java 1.9 (1.9.0-ea), the installation goes on fine and it does not complain.
Oracle Java version used:
java version "1.9.0-ea"
Java(TM) SE Runtime Environment (build 1.9.0-ea-b66)
Java HotSpot(TM) 64-Bit Server VM (build 1.9.0-ea-b66, mixed mode)
But when you try to invoke scala shell, you might see error as:
scala> [init] error: error while loading package, Missing dependency 'class java.lang.Object', required by /usr/share/java/scala-library. jar(scala/package.class)
Failed to initialize compiler: class java.lang.String not found.
** Note that as of 2.8 scala does not assume use of the java classpath.
** For the old behavior pass -usejavacp to scala, or if using a Settings
** object programatically, settings.usejavacp.value = true.
Case 2:
Later trying to use Oracle Java 1.8,
Oracle Java version used:
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)
Invoking scala shell gives error as:
scala> [init] error: error while loading AnnotatedElement, class file '/usr/lib/jvm/java-8-oracle/ jre/lib/rt.jar(java/lang/ reflect/AnnotatedElement. class)' is broken
(bad constant pool tag 18 at byte 76)
Case 3:
Using Oracle Java version 1.7,
Oracle Java version used:
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
Invoking scala shell and compiling & running scala programs goes fine.
Case 4:
Using Oracle Java version 1.6,
Oracle Java version used:
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
Invoking scala shell and compiling & running scala programs goes fine.
Case 1:
While trying to setup scala 2.9.2 on Ubuntu 15.04 using Oracle Java 1.9 (1.9.0-ea), the installation goes on fine and it does not complain.
Oracle Java version used:
java version "1.9.0-ea"
Java(TM) SE Runtime Environment (build 1.9.0-ea-b66)
Java HotSpot(TM) 64-Bit Server VM (build 1.9.0-ea-b66, mixed mode)
But when you try to invoke scala shell, you might see error as:
scala> [init] error: error while loading package, Missing dependency 'class java.lang.Object', required by /usr/share/java/scala-library.
Failed to initialize compiler: class java.lang.String not found.
** Note that as of 2.8 scala does not assume use of the java classpath.
** For the old behavior pass -usejavacp to scala, or if using a Settings
** object programatically, settings.usejavacp.value = true.
Case 2:
Later trying to use Oracle Java 1.8,
Oracle Java version used:
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)
Invoking scala shell gives error as:
scala> [init] error: error while loading AnnotatedElement, class file '/usr/lib/jvm/java-8-oracle/
(bad constant pool tag 18 at byte 76)
Case 3:
Using Oracle Java version 1.7,
Oracle Java version used:
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
Invoking scala shell and compiling & running scala programs goes fine.
Case 4:
Using Oracle Java version 1.6,
Oracle Java version used:
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
Invoking scala shell and compiling & running scala programs goes fine.