Is there a way to execute a scala script from Eclipse with scala plugin?
A scala script is a scala file which is executed line by line, without forcing you to write a main method. See the Description
section in scala's man page.
Is there a way to execute a scala script from Eclipse with scala plugin?
A scala script is a scala file which is executed line by line, without forcing you to write a main method. See the Description
section in scala's man page.
Don't know about running a script from Eclipse, but you can do something like this:
object Main extends Application {
println("Look, no main(args: Array[String])")
}
If I recall correctly, the Scala Eclipse plugin comes with an interactive console in which you can execute your Scala script. Detail of how to activate it has escaped me since I haven't been using Eclipse for Scala development for a long time. Look it up, its there.
You can open an interactive shell by right-clicking on the project, selecting Scala-> Create interpreter in XYZ.
If you have the scala distribution installed on the same machine, you can configure the "External Tools" to run scala scripts.
From the menu, select "Run" -> "External Tools" -> "External Tools Configurations...".
Highlight "Program" and create a new configuration.
Fill out the dialog like so:
"Main" tab:
Name: ScalaScriptRunner
Location: c:\path\to\scala\bin\scala.bat [or use the *nix equiv]
Working Directory: ${workspace_loc}
Arguments: ${resource_loc}
"Common" tab:
Check the "Display in Favorites" selection.
Click "Apply" and "Close".
Now, if you highlight a scala script file, you can run it from the toolbar. Note that this is independent of the scala eclipse plugin, and in fact, you may have to name your scripts a different extension (.scalascript?) if you have it installed.