Fiz uma classe simples, mas ainda encontro dificuldades para compilar:
Conteúdo de HolaMundo.scala:
def main(args: Array[String]) {
println("Hola, mundo!")
}
}
O meu Scala está instalado em C:\Program Files (x86)\scala\
Veja o que acontece quando tento compilar:
C:\Program Files (x86)\scala\bin>scalac C:\Users\usu1\usu1\scala\HolaMundo
.scala
error:
while compiling: C:\Users\usu1\usu1\scala\HolaMundo.scala
during phase: jvm
library version: version 2.10.0
compiler version: version 2.10.0
reconstructed args:
last tree to typer: Literal(Constant(Hola, mundo!))
symbol: null
symbol definition: null
tpe: String("Hola, mundo!")
symbol owners:
context owners: object HolaMundo -> package <empty>
== Enclosing template or block ==
Template( // val <local HolaMundo>: <notype> in object HolaMundo, tree.tpe=HolaM
undo.type
"java.lang.Object" // parents
ValDef(
private
"_"
<tpt>
<empty>
)
// 2 statements
DefDef( // def main(args: Array[String]): Unit in object HolaMundo
<method>
"main"
[]
// 1 parameter list
ValDef( // args: Array[String]
<param>
"args"
<tpt> // tree.tpe=Array[String]
<empty>
)
<tpt> // tree.tpe=Unit
Apply( // def println(x: Object): Unit in object Predef, tree.tpe=Unit
scala.this."Predef"."println" // def println(x: Object): Unit in object Pr
edef, tree.tpe=(x: Object)Unit
"Hola, mundo!"
)
)
DefDef( // def <init>(): HolaMundo.type in object HolaMundo
<method>
"<init>"
[]
List(Nil)
<tpt> // tree.tpe=HolaMundo.type
Block( // tree.tpe=Unit
Apply( // def <init>(): Object in class Object, tree.tpe=Object
HolaMundo.super."<init>" // def <init>(): Object in class Object, tree.t
pe=()Object
Nil
)
()
)
)
)
== Expanded type of tree ==
ConstantType(value = Constant(Hola, mundo!))
uncaught exception during compilation: java.io.IOException
error: Acesso negado
two errors found
C:\Program Files (x86)\scala\bin>