I'm a Java programmer and started studying Scala in my free time. Have this little problem driving me mad...
Every time I run a Scala script, at the end of the execution, the jvm doesn't quit, and I always have to kill the process by myself, which is quite annoying
The case is the following: given the little hello world in main.scala file
object Main {
def main(args: Array[String]): Unit = {
println("Hello world")
}
}
run it with
scala main.scala
then with ps -ef I have
501 5739 5727 0 9:46PM ttys000 0:18.08 /usr/bin/java -Xmx256M -Xms32M -Xbootclasspath/a:/MyStuff/ScalaFiles/scala-2.10.1/lib/akka-actors.jar:/MyStuff/ScalaFiles/scala-2.10.1/lib/jline.jar:/MyStuff/ScalaFiles/scala-2.10.1/lib/scala-actors-migration.jar:/MyStuff/ScalaFiles/scala-2.10.1/lib/scala-actors.jar:/MyStuff/ScalaFiles/scala-2.10.1/lib/scala-compiler.jar:/MyStuff/ScalaFiles/scala-2.10.1/lib/scala-library.jar:/MyStuff/ScalaFiles/scala-2.10.1/lib/scala-partest.jar:/MyStuff/ScalaFiles/scala-2.10.1/lib/scala-reflect.jar:/MyStuff/ScalaFiles/scala-2.10.1/lib/scala-swing.jar:/MyStuff/ScalaFiles/scala-2.10.1/lib/scalap.jar:/MyStuff/ScalaFiles/scala-2.10.1/lib/typesafe-config.jar -classpath "" -Dscala.home=/MyStuff/ScalaFiles/scala-2.10.1 -Dscala.usejavacp=true scala.tools.nsc.MainGenericRunner scala.tools.nsc.CompileServer
which of course is the jvm, and have to quit it by myself.
I tried putting
System.exit(0)
or sys.exit(0)
but nothing changed. Do you have the same issue?
Thanks a lot
fsc -shutdownto completely stop instance or provide-max-idle noption at fsc start (perhaps in sbt definition, but I'm not sure), where n is time in minutes after which fsc goes down, 0 is for immortal fsc. - om-nom-nom