我尝试使用 scala 语言的简单示例。我安装sbt
成功。运行时,sbt -h
我看到来自 sbt 的帮助消息:
Usage: sbt [options]
-h | -help print this message
-v | -verbose this runner is chattier
-d | -debug set sbt log level to debug
-no-colors disable ANSI color codes
-sbt-create start sbt even if current directory contains no sbt project
-sbt-dir <path> path to global settings/plugins directory (default: ~/.sbt)
-sbt-boot <path> path to shared boot directory (default: ~/.sbt/boot in 0.11 series)
-ivy <path> path to local Ivy repository (default: ~/.ivy2)
-mem <integer> set memory options (default: 1536, which is -Xms1536m -Xmx1536m -XX:MaxPermSize=384m -XX:ReservedCodeCacheSize=192m) ....
但是当我尝试在带有 scala 作业的目录中运行时(这是 Coursera 课程),我发现了错误:
nazar_art@nazar-desctop:~/scala/example$ sbt
Detected sbt version 0.12.1
Starting sbt: invoke with -help for other options
Error occurred during initialization of VM
Could not reserve enough space for object heap
但它应该打开 sbt 命令提示符。像这样:
shell$ cd /path/to/progfun-project-directory # This is the shell of the operating system
shell$ sbt
> _ # This is the sbt shell
更新:
在我添加以下行之后
java -Xms64M -Xmx256M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=64M -jar
目录名 $0/sbt-launch.jar "$@"
在/usr/bin
我看到下一个输出:
nazar_art@nazar-desctop:/usr/bin$ sbt
bash: /usr/bin/sbt: Permission denied
nazar_art@nazar-desctop:/usr/bin$ sudo sbt
sudo: sbt: command not found
- 为什么会这样?
- 如何解决这个问题?