How can I run a Scala project as a Scala application by default in Eclipse IDE?
Asked Answered
S

1

6

I am a novice to the Eclipse IDE and the question is how can I run a Scala project as a Scala application by default? When I run the project by hitting the ⌘R key, it always asks how to run it, as a Scala or Java application. Is there a way to skip this and always run it as Scala by default?

I guess it's somehow related to the launch configuration, but when I try to make a new launch configuration for the project, it doesn't give me the option of Scala: only Java applet and Java application are shown as choices.

I appreciate your help in advance!

Spinode answered 3/6, 2012 at 17:29 Comment(0)
E
2

Window > Preferences > General > Keys

Scroll down and select Run Scala Application

Edit the Binding to ⌘R or whatever you want.

This changes the binding for your whole workspace, so it doesn't distinguish between Java and Scala applications. It would be nice if the runner had a box you could tick to choose the default, but this is a decent workaround.

Evolve answered 3/6, 2012 at 19:41 Comment(2)
Thanks for the answer, Luigi! By the way, is this really what they are doing? I can't believe they got the developers to hit 2 or 3 key sequences whenever they build and run the code. :/Spinode
It's only one key sequence and you can bind it to a single key (say, F11) if you want, so it's just a single keypress. The only disadvantages are a) to run a Java project in the same workspace you need to assign a different key, and b) the "run" button in the GUI, if you use that instead of the keyboard, still asks you how you want to run it. Neither of which is a big deal.Evolve

© 2022 - 2024 — McMap. All rights reserved.