Closed xuwei-k closed 3 years ago
Workaround (sorry, forgot in release notes!): -nobootcp -nc
Workaround (sorry, forgot in release notes!): -nobootcp -nc
Thanks!
Thank you very much for testing and reporting. I updated the release notes
I just realized not only REPL
but scalac -nobootcp A.scala
works 😃
The spelling of Failed to disable litteral next character
is due to jline.
same issue when i'm trying to start sbt
Java HotSpot(TM) 64-Bit Server VM warning: Ignoring option MaxPermSize; support was removed in 8.0
java.lang.NullPointerException
at scala.reflect.io.JavaToolsPlatformArchive.iterator(ZipArchive.scala:242)
at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
at scala.reflect.io.AbstractFile.foreach(AbstractFile.scala:92)
at scala.tools.nsc.util.DirectoryClassPath.traverse(ClassPath.scala:308)
at scala.tools.nsc.util.DirectoryClassPath.x$16$lzycompute(ClassPath.scala:317)
at scala.tools.nsc.util.DirectoryClassPath.x$16(ClassPath.scala:317)
at scala.tools.nsc.util.DirectoryClassPath.packages$lzycompute(ClassPath.scala:317)
at scala.tools.nsc.util.DirectoryClassPath.packages(ClassPath.scala:317)
at scala.tools.nsc.util.DirectoryClassPath.packages(ClassPath.scala:297)
at scala.tools.nsc.util.MergedClassPath$$anonfun$packages$1.apply(ClassPath.scala:375)
at scala.tools.nsc.util.MergedClassPath$$anonfun$packages$1.apply(ClassPath.scala:375)
at scala.collection.Iterator$class.foreach(Iterator.scala:727)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1157)
at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
at scala.tools.nsc.util.MergedClassPath.packages$lzycompute(ClassPath.scala:375)
at scala.tools.nsc.util.MergedClassPath.packages(ClassPath.scala:370)
at scala.tools.nsc.symtab.SymbolLoaders$PackageLoader.doComplete(SymbolLoaders.scala:243)
at scala.tools.nsc.symtab.SymbolLoaders$SymbolLoader.complete(SymbolLoaders.scala:194)
at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1231)```
@zxxc make sure you're using sbt 0.13.17 or the latest 1.1.x; older versions don't work on Java 9 (I forget exactly when in the 1.x series support started). check project/build.properties
as well as whatever launcher you have installed. if this is mysterious, see https://www.scala-sbt.org/support.html for where to seek further help with sbt
I just ran into this issue while playing with bloop
, and zinc
for java11. Adding the command line args doesn't seem very desireable. I believe tools.jar
("jdk.tools" % "jdk.tools" % "1.8" % "system"
) was removed in java9
(http://openjdk.java.net/jeps/220) so simply adding the dependency explicitly should fix this issue.
Quick Edit: These are now MODULES and not just libraries that can be included. So slightly more complicated.
/cc @jvican -- something to consider fixing on the bloop runner side of things?
For reasons unknown (and perhaps I should find out) this doesn't reproduce with the coursier-based runners ([1]):
15:10:31 $ java -version
openjdk version "11.0.3" 2019-04-16
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.3+7)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.3+7, mixed mode)
15:10:33 $ scala -210
Failed to created JLineReader: java.lang.NoClassDefFoundError: scala/tools/jline/console/ConsoleReader
Falling back to SimpleReader.
Welcome to Scala version 2.10.7 (OpenJDK 64-Bit Server VM, Java 11.0.3).
Type in expressions to have them evaluated.
Type :help for more information.
scala> "2.10.7"
res0: String = 2.10.7
scala> ^D
15:10:45 $ scala -211
Welcome to Scala 2.11.12 (OpenJDK 64-Bit Server VM, Java 11.0.3).
Type in expressions for evaluation. Or try :help.
scala> "2.11.12"
res0: String = 2.11.12
scala> :quit
@er1c Did the error go away with latest Bloop version? I remember you sent some patches to fix Bloop on Java 9+ but I'm not sure if they fixed this particular issue.
Closing, since 2.10 and 2.11 development have ceased and the problem doesn't exist in later Scala versions.
Hopefully there is still a ticket to make -nobootcp
the default.
Hi, is this supposed to still be an issue?
$ scala
Welcome to Scala version 2.10.7 (OpenJDK 64-Bit Server VM, Java 11.0.13).
Type in expressions to have them evaluated.
Type :help for more information.
scala>
Failed to initialize compiler: NoClassDefFoundError.
This is most often remedied by a full clean and recompile.
Otherwise, your classpath may continue bytecode compiled by
different and incompatible versions of scala.
java.lang.NoClassDefFoundError: javax/tools/ToolProvider
at scala.reflect.io.JavaToolsPlatformArchive.iterator(ZipArchive.scala:242)
at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
at scala.reflect.io.AbstractFile.foreach(AbstractFile.scala:92)
at scala.tools.nsc.util.DirectoryClassPath.traverse(ClassPath.scala:308)
at scala.tools.nsc.util.DirectoryClassPath.x$16$lzycompute(ClassPath.scala:317)
at scala.tools.nsc.util.DirectoryClassPath.x$16(ClassPath.scala:317)
at scala.tools.nsc.util.DirectoryClassPath.packages$lzycompute(ClassPath.scala:317)
at scala.tools.nsc.util.DirectoryClassPath.packages(ClassPath.scala:317)
at scala.tools.nsc.util.DirectoryClassPath.packages(ClassPath.scala:297)
at scala.tools.nsc.util.MergedClassPath$$anonfun$packages$1.apply(ClassPath.scala:375)
at scala.tools.nsc.util.MergedClassPath$$anonfun$packages$1.apply(ClassPath.scala:375)
at scala.collection.Iterator$class.foreach(Iterator.scala:727)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1157)
at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
at scala.tools.nsc.util.MergedClassPath.packages$lzycompute(ClassPath.scala:375)
at scala.tools.nsc.util.MergedClassPath.packages(ClassPath.scala:370)
at scala.tools.nsc.symtab.SymbolLoaders$PackageLoader.doComplete(SymbolLoaders.scala:243)
at scala.tools.nsc.symtab.SymbolLoaders$SymbolLoader.complete(SymbolLoaders.scala:194)
at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1231)
at scala.reflect.internal.Mirrors$RootsBase.init(Mirrors.scala:240)
at scala.tools.nsc.Global.rootMirror$lzycompute(Global.scala:59)
at scala.tools.nsc.Global.rootMirror(Global.scala:57)
at scala.tools.nsc.Global.rootMirror(Global.scala:37)
at scala.reflect.internal.Definitions$DefinitionsClass.<init>(Definitions.scala:166)
at scala.reflect.internal.Definitions$definitions$.<init>(Definitions.scala:20)
at scala.reflect.internal.SymbolTable.definitions$lzycompute(SymbolTable.scala:13)
at scala.reflect.internal.SymbolTable.definitions(SymbolTable.scala:13)
at scala.tools.nsc.Global$Run.<init>(Global.scala:1290)
at scala.tools.nsc.interpreter.IMain.scala$tools$nsc$interpreter$IMain$$_initialize(IMain.scala:149)
at scala.tools.nsc.interpreter.IMain$$anonfun$ini
$ scala -nobootcp
Welcome to Scala version 2.10.7 (OpenJDK 64-Bit Server VM, Java 11.0.13).
Type in expressions to have them evaluated.
Type :help for more information.
scala>
I tried this with:
$ java -version
openjdk version "11.0.13" 2021-10-19
OpenJDK Runtime Environment (build 11.0.13+8-suse-2.3-x8664)
OpenJDK 64-Bit Server VM (build 11.0.13+8-suse-2.3-x8664, mixed mode)
$ java -version
openjdk version "11.0.14.1" 2022-02-08
OpenJDK Runtime Environment (build 11.0.14.1+1-suse-2.1-x8664)
OpenJDK 64-Bit Server VM (build 11.0.14.1+1-suse-2.1-x8664, mixed mode)
$ java -version
openjdk version "11.0.14.1" 2022-02-08
OpenJDK Runtime Environment Temurin-11.0.14.1+1 (build 11.0.14.1+1)
OpenJDK 64-Bit Server VM Temurin-11.0.14.1+1 (build 11.0.14.1+1, mixed mode)
$ java -version
openjdk version "17.0.2" 2022-01-18
OpenJDK Runtime Environment Temurin-17.0.2+8 (build 17.0.2+8)
OpenJDK 64-Bit Server VM Temurin-17.0.2+8 (build 17.0.2+8, mixed mode, sharing)
and
scala> util.Properties.versionString
res0: String = version 2.10.7
Hi, is this supposed to still be an issue?
Yes, we're aware the problem still exists in 2.10.7 and 2.11.12. As I wrote earlier:
Closing, since 2.10 and 2.11 development have ceased and the problem doesn't exist in later Scala versions
We only keep a ticket open if the problem still exists in the HEAD of the current development branch (namely 2.13.x).
@tacerus The getting started page https://docs.scala-lang.org/getting-started/index.html links to the JDK matrix https://docs.scala-lang.org/overviews/jdk-compatibility/overview.html
The somewhat orthogonal issue of coping with classloaders and modules, either from CLI or other environments, is ongoing.
Ah, apologies @SethTisue, I missed the version issue - I will attempt the latest release! Thanks!
Thank you @som-snytt for linking the version matrix, that is very helpful!