How to configure Eclipse to start automatically as a Scala application?

I created 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 make Eclipse know that a project or application file should always run as Scala?

+4
source share
2 answers
  • Click on the menu item named Window in the Eclipse window.
  • Select Settings from the drop-down list.
  • When the Settings window opens, use the menu on the left to go to Run / Debug , then Run
  • In the Run operation check this box with the following description: Always launch a previously launched application .

Then Eclipse should ask you only once and remember this choice.

+5
source

@soc describes a workaround to the problem. There is currently no other / better way to get this to work. It needs to be fixed in the future.

Fortunately, this problem has been partially fixed in the current nightly build of the Scala IDE. There is a fix for another issue that disables the Run from Java option: Disable JavaLaunchableTester in Scala files

It does not work for all cases, for example, if a single right-click on a package displays the known Run As options. But for objects with the main method, it works quite well if you use the "Run as" option in the source file.

0
source

All Articles