[comment]: # Scala on Visual Studio Code

Download and install Scala

Download a scala installation package from here.

Then install it.

  • Linux
scala_package_name=$(ls scala*.tgz | sort -r | head -1)
tar -xzf $scala_package_name
mv ${scala_package_name%.*} scala

Configure system variables:

  • Linux
export SCALA_HOME=/opt/scala
PATH=%PATH%:$SCALA_HOME/bin
  • Windows
SCALA_HOME=C:\Program Files (x86)\scala
PATH=%SCALA_HOME%\bin;%PATH%

Test

scala
  • Output:
Welcome to Scala 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_60).
Type in expressions for evaluation. Or try :help. scala>

Configur a project in visual studio code

  • Open a project via File -> Open Folder...
  • Create a tasks.json file under the .vscode folder in the project folder.
  • Input below in the task.json file
// A task runner that runs a scala program
{
"version": "0.1.0",
"isShellCommand": true,
"args": [],
"showOutput": "always",
"echoCommand": true,
"suppressTaskName": true,
"windows": {
"command": "cmd",
"args": [
"/C",
"scala.bat"
]
},
"linux": {
"command": "sh",
"args": [
"scala"
]
},
"osx": {
"command": "sh",
"args": [
"scala"
]
},
"tasks": [
{
"taskName": "run",
"isBuildCommand": true,
"args": [
"${file}"
]
}
]
}

Note: I am using Windows, you need to change scala.bat to scala (I guess).

Linux

Test it

  • Create a file test.scala with code
object HelloWorld {
def main(args: Array[String]): Unit = {
println("Hello, world!")
}
}
  • press ctrl+shift+b
  • Output:
Hello, world!

Compile .scala to .jar

scalac -d test.jar D:\project\*

Scala on Visual Studio Code的更多相关文章

  1. 30个极大提高开发效率的Visual Studio Code插件

    译者按: 看完这篇文章,我打算从 Sublime Text 转到 Visual Studio Code 了! 原文: Immensely upgrade your development enviro ...

  2. Visual Studio Code插件

    Material Theme 下载量:130 万 Visual Studio Code 最悠久的主题! Auto Import 下载量:46 万 自动去查找.分析.然后提供代码补全.对于 TypeSc ...

  3. Visual Studio Code(VS code)介绍

    一.日常安利 VS code VS vode特点: 开源,免费: 自定义配置 集成git 智能提示强大 支持各种文件格式(html/jade/css/less/sass/xml) 调试功能强大 各种方 ...

  4. Visual Studio Code 代理设置

    Visual Studio Code (简称 VS Code)是由微软研发的一款免费.开源的跨平台文本(代码)编辑器,在十多年的编程经历中,我使用过非常多的的代码编辑器(包括 IDE),例如 Fron ...

  5. 在Visual Studio Code中配置GO开发环境

    一.GO语言安装 详情查看:GO语言下载.安装.配置 二.GoLang插件介绍 对于Visual Studio Code开发工具,有一款优秀的GoLang插件,它的主页为:https://github ...

  6. Visual Studio Code——Angular2 Hello World 之 2.0

    最近看到一篇用Visual Studio Code开发Angular2的文章,也是一篇入门教程,地址为:使用Visual Studio Code開發Angular 2專案.这里按部就班的做了一遍,感觉 ...

  7. docker4dotnet #3 在macOS上使用Visual Studio Code和Docker开发asp.net core和mysql应用

    .net猿遇到了小鲸鱼,觉得越来越兴奋.本来.net猿只是在透过家里那田子窗看外面的世界,但是看着海峡对岸的苹果园越来越茂盛,实在不想再去做一只宅猿了.于是,.net猿决定搭上小鲸鱼的渡轮到苹果园去看 ...

  8. Visual Studio Code v0.9.1 发布

    微软的跨平台编辑器 Visual Studio Code v0.9.1 已经发布,官方博客上发布文章Visual Studio Code – October Update (0.9.1):http:/ ...

  9. 微软Visual Studio Code 0.8.0发布,新增多种主题

    月30日,Build 开发者大会上,正式宣布了 Visual Studio Code 项目;并将其定义为:一个运行于 Mac OS X.Windows和 Linux 之上的,针对于编写现代 Web 和 ...

随机推荐

  1. ora-01031:insufficient privileges解决方法 - 转

    今天晚上要远程修改一个分公司的数据库参数,于是下午先远程过去做些准备工作.数据库是oracle 11g rac,操作系统是windows 2008 server,我还是第一次见过windows下的or ...

  2. Python测试基础教程

    Python简明教程1-为什么 Pythonhttp://www.automationqa.com/forum.php?mod=viewthread&tid=3674&fromuid= ...

  3. Groovy split竖杆注意

    前几天将09年写的一个Asp程序使用Grails改造重写,在处理手机号码Split的时候,Asp代码: dim phoneArr phoneArr = split(phones,"|&quo ...

  4. oracle 查询月份差

    select to_char(add_months(trunc(sysdate),-1),'yyyymm') from dual;

  5. 使用nodejs搭建图片服务器(一)

    背景 当我们开发一个Web项目的时候,为了将图片管理与web服务分离开,通常都会搭建一个图片服务器. 之所以选择nodejs是因为使用nodejs来搭建web项目相当简单而且快速,虽然这个图片服务器很 ...

  6. Struts2知多少(1) Struts2 MVC架构

    模型视图控制器(Model View Controller)或MVC,MVC是俗称,是一种软件设计模式,用于开发Web应用程序.模型 - 视图 - 控制器模式是由以下三个部分组成: Model - 模 ...

  7. Uvaoj 11248 Frequency Hopping(Dinic求最小割)

    题意:1到n节点(节点之间有一定的容量),需要流过C的流量,问是否可以?如果可以输出possible, 否则如果可以扩大任意一条边的容量 可以达到目的,那么输出possible option:接着输出 ...

  8. Hadoop入门进阶课程11--Sqoop介绍、安装与操作

    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,博主为石山园,博客地址为 http://www.cnblogs.com/shishanyuan  ...

  9. Pagekit – 现代化技术构建的轻量的 CMS 系统

    Pagekit 是一个模块化,轻量的 CMS 系统,基于现代化的技术,如 Symfony 组件和 Doctrine.它提供了一个很好的平台,用于主题和延伸开发.Pagekit 为您提供了工具来创造美丽 ...

  10. [linux]收集一些好玩的命令

    1.rev命令 反转输出,输入的字符串. 在终端中输入:rev 输入需要字符串(支持中文) 2.asciiview命令 安装aview:apt-get install aview 再安装imagema ...