Neil
Neil

Reputation: 25905

How do you configure Eclipse to automatically "run as Scala application"?

I made a Scala package and a Scala application in Eclipse, but every time I try to run it from Run > Run, Eclipse asks me:

Select a way to run 'example.scala':
- Java Application
- Scala Application

How can I get Eclipse to know that the project or application file should always run as Scala?

Upvotes: 4

Views: 2997

Answers (2)

kiritsuku
kiritsuku

Reputation: 53358

@soc describes a workaround to the problem. At the moment there is no other/better way to make this to work. It needs to be fixed in future.

Luckily, this issue is partially fixed in the current nightly build of the Scala IDE. There is a fix for another problem, that disables the "Run As Java" Option: Disable JavaLaunchableTester on Scala files

It works not for all cases, for example if one right clicks on a package the known "Run As" Options are displayed. But for objects with a main method it works quite well if one uses the "Run As" Option of the Source file.

Upvotes: 0

soc
soc

Reputation: 28453

  1. Click on the menu item named Window in your Eclipse window.
  2. Select Preferences from the drop-down list.
  3. Once the Preferences window has opened, use the menu at the left to navigate to Run/Debug, then Launching
  4. Under Launch Operation, tick the check box with the following description: Always launch the previously launched application.

Afterwards, Eclipse should ask you only once and remember that choice.

Upvotes: 6

Related Questions