0

I installed scala with sbt according this post Getting started.

But when I created easy start project Hello world I met weird output:

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)

I can't understand why this happen coz I'm su.
Any suggestions.

EDIT:

I used chmod 777 for update.log. But now when I try to run sbt I have:

-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
  • How to solve this trouble?
catch23
  • 17,519
  • 42
  • 144
  • 217

2 Answers2

1

What does 'ls -l ~/.sbt/boot' return?

joescii
  • 6,495
  • 1
  • 27
  • 32
  • It returns `-rw-r--r-- 1 root root 0 Aug 13 10:42 update.log` – catch23 Aug 13 '13 at 10:29
  • Take ownership of it: su chown -R nazar_art ~/.sbt – joescii Aug 13 '13 at 10:46
  • For your new issue, try decreasing the heap size to 1G per http://stackoverflow.com/questions/15280839/how-to-set-heap-size-for-sbt – joescii Aug 13 '13 at 11:44
  • Any luck with that? I'm a bit skeptical just because sbt was running in the JVM prior to the permissions change, albeit with IO errors. Maybe try running sbt as su since root owns everything. – joescii Aug 13 '13 at 12:26
0

Looks like you resolved your first question. For the 2nd error you've got, please add

export SBT_OPTS="-Xmx2G"

and retry(change 2G part as you want depends on your dev enviroment). Sbt complaint about lack of JVM heap size, so you need to increase those.

wonhee
  • 1,581
  • 1
  • 14
  • 24