zoukankan      html  css  js  c++  java
  • 安装好Scala之后,从cmd启动scala发生空指针异常的解决方法

    我安装的scala的版本是2.12.11,Java版本是1.8,之前使用scala 2.11.8的时候从命令行启动scala,没有出现过空指针异常,但是换到2.12版本之和,就出现了这个问题。

    java.lang.NullPointerException at java.util.Arrays.sort(Arrays.java:1438) at scala.tools.nsc.classpath.JFileDirectoryLookup.listChildren(DirectoryClassPath.scala:113) at scala.tools.nsc.classpath.JFileDirectoryLookup.listChildren$(DirectoryClassPath.scala:97) at scala.tools.nsc.classpath.DirectoryClassPath.listChildren(DirectoryClassPath.scala:202) at scala.tools.nsc.classpath.DirectoryClassPath.listChildren(DirectoryClassPath.scala:202) at scala.tools.nsc.classpath.DirectoryLookup.list(DirectoryClassPath.scala:73) at scala.tools.nsc.classpath.DirectoryLookup.list$(DirectoryClassPath.scala:69) at scala.tools.nsc.classpath.DirectoryClassPath.list(DirectoryClassPath.scala:202) at scala.tools.nsc.classpath.AggregateClassPath.$anonfun$list$1(AggregateClassPath.scala:76) at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:234) at scala.collection.Iterator.foreach(Iterator.scala:929) at scala.collection.Iterator.foreach$(Iterator.scala:929) at scala.collection.AbstractIterator.foreach(Iterator.scala:1417) at scala.collection.IterableLike.foreach(IterableLike.scala:71) at scala.collection.IterableLike.foreach$(IterableLike.scala:70) at scala.collection.AbstractIterable.foreach(Iterable.scala:54) at scala.collection.TraversableLike.map(TraversableLike.scala:234) at scala.collection.TraversableLike.map$(TraversableLike.scala:227) at scala.collection.AbstractTraversable.map(Traversable.scala:104) at scala.tools.nsc.classpath.AggregateClassPath.list(AggregateClassPath.scala:74) at scala.tools.nsc.symtab.SymbolLoaders$PackageLoader.doComplete(SymbolLoaders.scala:271) at scala.tools.nsc.symtab.SymbolLoaders$SymbolLoader.complete(SymbolLoaders.scala:220) at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1530) at scala.reflect.internal.Mirrors$RootsBase.init(Mirrors.scala:225) at scala.tools.nsc.Global.rootMirror$lzycompute(Global.scala:65) at scala.tools.nsc.Global.rootMirror(Global.scala:63) at scala.tools.nsc.Global.rootMirror(Global.scala:36) at scala.reflect.internal.Definitions$DefinitionsClass.ObjectClass$lzycompute(Definitions.scala:267) at scala.reflect.internal.Definitions$DefinitionsClass.ObjectClass(Definitions.scala:267) at scala.reflect.internal.Definitions$DefinitionsClass.init(Definitions.scala:1422) at scala.tools.nsc.Global$Run.<init>(Global.scala:1164) at scala.tools.nsc.interpreter.IMain._initialize(IMain.scala:125) at scala.tools.nsc.interpreter.IMain.initializeSynchronous(IMain.scala:147) at scala.tools.nsc.interpreter.ILoop.$anonfun$process$11(ILoop.scala:1030) at scala.tools.nsc.interpreter.ILoop.startup$1(ILoop.scala:1011) at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:1049) at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:82) at scala.tools.nsc.MainGenericRunner.run$1(MainGenericRunner.scala:85) at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:96) at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:101) at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)

    在网上查找资料,看到原因是没有配置classpath变量,于是在配置完classpath之后解决了这个问题。具体的步骤如下:

    打开控制面板的高级系统设置,配置环境变量,找到classpath这一项(前提是环境变量已经配置好)将下面的值复制进去
    .;%SCALA_HOME%in;%SCALA_HOME%libdt.jar;%SCALA_HOME%lib ools.jar

    注意,“.;”这个永远放在最前面。

  • 相关阅读:
    防止vue文件中的样式出现‘污染’情况(html5 scoped特性)
    Vue.js中滚动条加载更多数据
    本地上传文件至服务器的技巧(linux文件压缩及解压文件)
    ubuntu下apache新建虚拟主机
    laravel5.4+vue+element简单搭建(gulp+laravel Elixir)
    java基础---->Java的格式化输出
    markdown 基本语法(转载)
    谷歌断点调试
    mac 远程连接 云服务器
    棋盘覆盖问题
  • 原文地址:https://www.cnblogs.com/yxym2016/p/14191983.html
Copyright © 2011-2022 走看看