0

当我尝试在 Scala 中运行示例 Hello world 时收到以下错误。该文件中保存了此语句。println("来自 Scala 脚本的 Hello World!"). 如何避免这些错误?

Sandeeps-MacBook-Pro:ScalaScripts sandeep$ scala Hello.scala
/Users/sandeep/Documents/ScalaScripts/Hello.scala:1: error: not found: value \
{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370
 ^
/Users/sandeep/Documents/ScalaScripts/Hello.scala:3: error: not found: value \
{\colortbl;\red255\green255\blue255;\red38\green38\blue38;}
 ^
/Users/sandeep/Documents/ScalaScripts/Hello.scala:3: error: not found: value \
{\colortbl;\red255\green255\blue255;\red38\green38\blue38;}
           ^
/Users/sandeep/Documents/ScalaScripts/Hello.scala:3: error: not found: value \
{\colortbl;\red255\green255\blue255;\red38\green38\blue38;}
                                    ^
/Users/sandeep/Documents/ScalaScripts/Hello.scala:4: error: not found: value \
\margl1440\margr1440\vieww10800\viewh8400\viewkind0
^
/Users/sandeep/Documents/ScalaScripts/Hello.scala:8: error: not found: value \
\f0\fs24 \cf2 println("Hello World from a Scala Script!")}
^
6 errors found
4

1 回答 1

1

你的路错了

看这条线

/Users/sandeep/Documents/ScalaScripts/Hello.scala

然后在这个

\margl1440\margr1440\vieww10800\viewh8400\viewkind0

类 Unix 系统/在其路径中使用正斜杠

此外,看起来您在脚本中的路径不是作为包装的字符串路径编写的"your path",Scala 编译器试图将其用作某个值

于 2013-05-24T06:34:12.657 回答