jQuery in Action, 3rd edition
The moose likes Scala and the fly likes Problem running Scala Script file from the terminal. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Languages » Scala
Bookmark "Problem running Scala Script file from the terminal." Watch "Problem running Scala Script file from the terminal." New topic
Author

Problem running Scala Script file from the terminal.

Sandip Bandyopadhyay
Greenhorn

Joined: Feb 04, 2012
Posts: 1
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

Joined: Sep 08, 2007
Posts: 3151
    
  33

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.


Mohamed Sanaulla | My Blog
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Problem running Scala Script file from the terminal.
 
It's not a secret anymore!