从命令行加载 Scala 文件 [英] Load a Scala File From Command Line
本文介绍了从命令行加载 Scala 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是 Scala 的新手,在从命令行运行 .scala 文件时遇到了问题.我试过以下命令
I'm fairly new to Scala and I'm having troubles running a .scala file from command line. I've tried the following commands
1.\PathToDirContaingingCode> scala myCode.scala
2.\PathToDirContaingingCode> scala
scala> :load myCode.scala
3.\PathToDirContaingingCode> scala
scala> :load \PathToDirContaingingCode\myCode.scala
所有这些都会导致该文件不存在"
All of these result in "That file does not exist"
我知道代码是正确的,因为我已经在 REPL 中运行了它.
I know that the code is correct because I've run it in the REPL already.
推荐答案
我终于找到了答案.
\PathToDirContainingCode> scala
scala> :lo myCode.scala
我正在寻找的正确 Scala 命令是 :lo
The proper Scala command I was looking for was :lo
这篇关于从命令行加载 Scala 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文