可以编译Scala程序,但不能运行它们 [英] Can compile Scala programs but can't run them
本文介绍了可以编译Scala程序,但不能运行它们的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以使用终端中的scalac编译scala程序,但是我收到警告。
I am able to compile scala programs using scalac in terminal but I get the warning.
Charless-Macintosh:src Charles$ scalac hello.scala
Charless-Macintosh:src Charles$ scala HelloWorld
No such file or class on classpath: HelloWorld
这与scala上的 .profile
有关。我很困惑,发生了什么。非常感谢。
Is this to do with .profile
on scala. I'm pretty confused as to what is happening. Many thanks
推荐答案
默认情况下,当前目录通常不在类路径中。所以你需要明确给出:
The current directory is typically not in the classpath by default. So you need to give explicitly:
$ scala -cp . HelloWorld
这篇关于可以编译Scala程序,但不能运行它们的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文