简体   繁体   English

尝试运行简单的“Hello!”示例脚本时,SBT会给出java.lang.NullPointerException

[英]SBT gives java.lang.NullPointerException when trying to run simple “Hello!” example script

I'm trying my hand at Scala for the first time, and I've chosen to do so using SBT 0.13.9 on a Linux machine running a new install of Ubuntu 14.04LTS. 我是第一次尝试使用Scala,我选择在运行新安装的Ubuntu 14.04LTS的Linux机器上使用SBT 0.13.9。

I've been following the instructions given on the SBT website to the letter, and I'm now trying to run the "Hello!" 我一直在按照SBT网站上给出的说明写信,我现在正试图运行“你好!” example script, which is as follows: 示例脚本,如下所示:

object Hi {
  def main(args: Array[String]) = println("Hi!")
}

When I try to run, I get the following output: 当我尝试运行时,我得到以下输出:

[trace] Stack trace suppressed: run last compile:compileIncremental for the full output.
[error] (compile:compileIncremental) java.lang.NullPointerException
[error] Total time: 1 s, completed 22 Aug 2015, 2:30:09 PM

Being completely new to Scala and SBT (and also relatively new to Linux) I'm sure I've just overlooked something obvious. 对于Scala和SBT来说是全新的(对Linux而言也相对较新)我确信我只是忽略了一些明显的东西。 No amount of Googling has yielded any answers so far though. 到目前为止,没有任何谷歌搜索引起任何答案。

What should I check first? 我应该先检查一下? I'd really appreciate any advice anyone can offer. 我真的很感激任何人都可以提供的建议。

I had the same error, on exactly the same code snippet! 在完全相同的代码片段中,我遇到了同样的错误! ie the first one in the scala sbt getting started hello.html 即scala中的第一个开始使用hello.html

My problem was resolved when i uninstalled the java 9 sdk and installed the java 8 sdk. 当我卸载java 9 sdk并安装java 8 sdk时,我的问题得到了解决。

Doing this required that i also had to then re-install scala and sbt. 这样做需要我还必须重新安装scala和sbt。

These I installed with the instructions from HERE but replacing the version numbers in the commands with scala-2.11.7.deb and sbt-0.13.9.deb (my dev machine being on ubuntu 14.04) 这些我按照HERE的说明安装,但用scala-2.11.7.deb和sbt-0.13.9.deb替换命令中的版本号(我的开发机器在ubuntu 14.04上)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 尝试在NetBeans上运行应用程序时出现java.lang.NullPointerException错误 - java.lang.NullPointerException bug when trying to run an app on netbeans 运行时java.lang.NullPointerException - java.lang.NullPointerException at run 尝试使用 Java 在 Selenium 中运行测试用例时,线程“主”java.lang.NullPointerException 出现异常 - Exception in thread "main" java.lang.NullPointerException when trying to run a test case in Selenium with Java 尝试使用cassandra数据存储区从eclipse运行nutch时获取java.lang.NullPointerException - getting java.lang.NullPointerException when trying to run nutch from eclipse with a cassandra datastore 尝试在Apache Tomcat上从Eclipse运行Servlet项目时的java.lang.NullPointerException - java.lang.NullPointerException when trying to run Servlet project from Eclipse on Apache Tomcat 尝试在Java中读取txt文件时出现java.lang.NullPointerException - java.lang.NullPointerException when trying to read txt file in java SessionFactory给了我java.lang.NullPointerException - SessionFactory gives me java.lang.NullPointerException 尝试在webDriver中使用@FindBy时获取java.lang.NullPointerException - Getting java.lang.NullPointerException when trying to use @FindBy in webDriver 尝试生成Allure Report时出现java.lang.NullPointerException - java.lang.NullPointerException when trying to generate Allure Report 尝试显示.gif文件时出现java.lang.NullPointerException? - java.lang.NullPointerException when trying to display a ,gif file?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM