Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem running Scala Script file from the terminal.

 
Sandip Bandyopadhyay
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to Scala. I have installed Scala 2.9 from the repository on Ubuntu 12.04. My Scala REPL is working perfect. I have compiled scala file perfectly but when I tried to run a simple script file [println ("Hello")] with -------> "scala Test.scala" I got the following error.
Exception in thread "main" java.lang.RuntimeException: Cannot figure out how to run target: Test.scala
at scala.sys.package$.error(package.scala:27)
at scala.tools.nsc.GenericRunnerCommand.scala$tools$nsc$GenericRunnerCommand$$guessHowToRun(GenericRunnerCommand.scala:38)
at scala.tools.nsc.GenericRunnerCommand$$anonfun$2.apply(GenericRunnerCommand.scala:48)
at scala.tools.nsc.GenericRunnerCommand$$anonfun$2.apply(GenericRunnerCommand.scala:48)
at scala.Option.getOrElse(Option.scala:108)
at scala.tools.nsc.GenericRunnerCommand.<init>(GenericRunnerCommand.scala:48)
at scala.tools.nsc.GenericRunnerCommand.<init>(GenericRunnerCommand.scala:17)
at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:33)
at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:89)
at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)

Please help me to get rid of this error. Thanking you in advance.

 
Mohamed Sanaulla
Saloon Keeper
Posts: 3159
33
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what are the contents of Test.scala?

I tried this:


then ran Test.scala using scala Test.scala and it works fine.

PS: I tried this on Windows, but I believe the platform shouldn't really matter.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic