当我尝试在Scala中运行示例Hello世界时,我收到以下错误。该文件中保存了此语句。 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
答案 0 :(得分:1)
你的路径错了
看看这一行
/Users/sandeep/Documents/ScalaScripts/Hello.scala
然后在此
\margl1440\margr1440\vieww10800\viewh8400\viewkind0
类Unix系统在其路径中使用正斜杠/
此外,您在脚本中编写的路径看起来不像"your path"
中包含的字符串路径,Scala编译器会尝试将其用作某个值