[英]scala - bash: hw.scala: Permission denied
我根據這篇文章開始使用sbt安裝了scala。
但是當我創建一個容易啟動的項目Hello world時,我遇到了奇怪的輸出:
nazar_art@nazar-desctop:~$ find .sbt
.sbt
.sbt/.lib
.sbt/.lib/0.12.1
.sbt/.lib/0.12.1/sbt-launch.jar
.sbt/boot
.sbt/boot/update.log
nazar_art@nazar-desctop:~$ cd hello
nazar_art@nazar-desctop:~/hello$ echo 'object Hi { def main(args: Array[String]) = println("Hi!") }' > hw.scala
bash: hw.scala: Permission denied
nazar_art@nazar-desctop:~/hello$ sbt
java.io.FileNotFoundException: /home/nazar_art/.sbt/boot/update.log (Permission denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:212)
at java.io.FileOutputStream.<init>(FileOutputStream.java:165)
at java.io.FileWriter.<init>(FileWriter.java:90)
at xsbt.boot.Update.<init>(Checks.java:51)
at xsbt.boot.Launch.update(Launch.scala:266)
at xsbt.boot.Launch$$anonfun$jnaLoader$1.apply(Launch.scala:111)
at scala.Option.getOrElse(Option.scala:108)
at xsbt.boot.Launch.jnaLoader$2f324eef(Launch.scala:106)
at xsbt.boot.Launch.<init>(Launch.scala:85)
at xsbt.boot.Launcher$.apply(Launch.scala:281)
at xsbt.boot.Launch$.apply(Launch.scala:16)
at xsbt.boot.Boot$.runImpl(Boot.scala:31)
at xsbt.boot.Boot$.main(Boot.scala:20)
at xsbt.boot.Boot.main(Boot.scala)
Error during sbt execution: java.io.FileNotFoundException: /home/nazar_art/.sbt/boot/update.log (Permission denied)
我不明白為什么會這樣,因為我是su
。
有什么建議么。
編輯:
我將chmod 777
用於update.log。 但是現在當我嘗試運行sbt時,我有:
-rwxrwxrwx 1 root root 63 Aug 13 11:17 hw.scala
nazar_art@nazar-desctop:~/hello$ sudo echo 'object Hi { def main(args: Array[String]) = println("Hi!") }' > hw.scala
nazar_art@nazar-desctop:~/hello$ sbt
Error occurred during initialization of VM
Could not reserve enough space for object heap
'ls -l〜/ .sbt / boot'返回什么?
看來您已經解決了第一個問題。 對於您遇到的第二個錯誤,請添加
出口SBT_OPTS =“-Xmx2G”
然后重試(根據您的開發環境,更改2G部分)。 Sbt抱怨缺少JVM堆大小,因此您需要增加這些大小。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.