configure run in eclipse for Scala

后端 未结 14 1707
自闭症患者
自闭症患者 2021-01-30 16:03

I am a beginner in Scala. I installed Scala IDE in eclipse and now I want to run my application programme. It never shows \"run as Scala application\", instead it shows \"run

相关标签:
14条回答
  • 2021-01-30 16:41

    make sure your declared package in your source code matches the directory structure under your source directory.

    in this case, a sourcefile declaring package "greeter" will auto-run as scala if the source file is indeed under src/greeter/Hello.scala (and not just under src/Hello.scala)

    Its a common mistake that doesn't get highlighted by the syntax checker.

    0 讨论(0)
  • 2021-01-30 16:41

    If it is the first time you run the Scala IDE for eclipse after setting it up and creating your project, all the thing you need is to just save your project and restart the IDE. At the next start, the "run as Scala Application" is appeared and can be used.

    0 讨论(0)
  • 2021-01-30 16:46

    I was having similar issue. Make sure your java and scala files are not in the same package. I changed the package names and it worked for me

    0 讨论(0)
  • 2021-01-30 16:47

    If you installed Scala plugin for Eclipse, open the Scala perspective. Then right-click on your project and select "Add Scala Nature" in "Configure" menu.

    You should now be able to run your Scala applications.

    0 讨论(0)
  • 2021-01-30 16:48

    Unless you have a strong reason why you need Eclipse, could I recommend that you try IntelliJ?

    Version 10 was just released earlier today, and the (free) community edition is perfectly happy working with the IntelliJ Scala plugin.

    0 讨论(0)
  • 2021-01-30 16:50

    Try to run the eclipse command of the sbt tool inside your project directory, this will build your scala project for the eclipse IDE. Then you will have no problem to configure your run configuration, It might even be done for you automatically.

        $ sbt
        > eclipse 
        [info] About to create Eclipse project files for your project(s).
        [info] Updating {file:/...path-to-your-project}root...
        [info] Resolving jline#jline;2.12.1 ...
        [info] Done updating.
        [info] Successfully created Eclipse project files for project(s):
        [info] your-project-name
    

    done! now import your project into Eclipse's workspace

    0 讨论(0)
提交回复
热议问题