scala 学习

Before you start

By default, the Scala plugin is not bundled with IntelliJ IDEA.

If IntelliJ IDEA recognizes that you have .scala files in your project then it displays the appropriate pop-up suggesting to install the Scala plugin. 

scala_plugin_popUp Click the link and in the dialog that opens, click  OK . choose_plugin_to_install_scala

Alternatively, you can use Settings to download and enable the plugin in IntelliJ IDEA.

Creating a project with a Scala module

  1. If no project is currently open in IntelliJ IDEA, click Create New Project on the Welcome screen. Otherwise, select File | New | Project.

    As a result, the New Project wizard opens.

  2. In the left-hand pane, select Scala.
    Note that if you select Java and in Additional Libraries and Frameworks, select Scala, you will create a Java project with a simple Scala module. However, the project will not include SBT, Play 2.x or Activator.
  3. In the right-hand pane, select Scala.
    You can also select SBT for creating an SBT project, Play 2.x for creating a project with the Play 2.x framework, Activator for creating a project with Typesafe Activator templates or Dotty for creating a project with the Dotty SDK.new_project_scalaClick Next.
  4. On the next page of the wizard, specify project and module location settings.scala_project_and_name_locationIf the Scala SDK is not specified, click Create, select a necessary SDK version for downloading and click OK.NewScalaSdkClick Finish.

Exploring your project structure

  1. Open Project Structure.
  2. On the left-hand pane, select Modules and on the right-hand side of the module page, you can check the project libraries, add the new ones, edit or delete the existing libraries.scala_project_structureClick OK.

Creating an object

  1. In the project tree, right-click a node in which you want to create your Scala object.
  2. From the drop-down list, select Scala class.create_scala_class
  3. In the dialog that opens, in the field Name, enter the name of your Scala object and in the field Kind select either Object, Class or Trait.create_new_scala_class_dialogClick OK.

Running your application

  1. In the project tree, right-click the application and from the context menu select Run 'application name'. Alternatively, press Shift+F10 to run the application. You can also right-click the left_gutter_run icon in the left gutter and select Run 'application name' command.run_scala_app

Before you start

By default, the Scala plugin is not bundled with IntelliJ IDEA.

If IntelliJ IDEA recognizes that you have .scala files in your project then it displays the appropriate pop-up suggesting to install the Scala plugin. 

scala_plugin_popUp Click the link and in the dialog that opens, click  OK . choose_plugin_to_install_scala

Alternatively, you can use Settings to download and enable the plugin in IntelliJ IDEA.

Creating a project with a Scala module

  1. If no project is currently open in IntelliJ IDEA, click Create New Project on the Welcome screen. Otherwise, select File | New | Project.

    As a result, the New Project wizard opens.

  2. In the left-hand pane, select Scala.
    Note that if you select Java and in Additional Libraries and Frameworks, select Scala, you will create a Java project with a simple Scala module. However, the project will not include SBT, Play 2.x or Activator.
  3. In the right-hand pane, select Scala.
    You can also select SBT for creating an SBT project, Play 2.x for creating a project with the Play 2.x framework, Activator for creating a project with Typesafe Activator templates or Dotty for creating a project with the Dotty SDK.new_project_scalaClick Next.
  4. On the next page of the wizard, specify project and module location settings.scala_project_and_name_locationIf the Scala SDK is not specified, click Create, select a necessary SDK version for downloading and click OK.NewScalaSdkClick Finish.

Exploring your project structure

  1. Open Project Structure.
  2. On the left-hand pane, select Modules and on the right-hand side of the module page, you can check the project libraries, add the new ones, edit or delete the existing libraries.scala_project_structureClick OK.

Creating an object

  1. In the project tree, right-click a node in which you want to create your Scala object.
  2. From the drop-down list, select Scala class.create_scala_class
  3. In the dialog that opens, in the field Name, enter the name of your Scala object and in the field Kind select either Object, Class or Trait.create_new_scala_class_dialogClick OK.

Running your application

  1. In the project tree, right-click the application and from the context menu select Run 'application name'. Alternatively, press Shift+F10 to run the application. You can also right-click the left_gutter_run icon in the left gutter and select Run 'application name' command.run_scala_app
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值