Cannot run main object
With the below hello world, the plugin does not recognize that this is a main class. I all compiles find however.
idea 8.1.3 and latest plugin
package com.si.reporting
object Main {
def main(args:Array[String]) = {
println("greeting")
}
}
Please sign in to leave a comment.
It's type inference issue. Because we run just main methods, which return Unit (I think it's not right in common). By in this example println("") treated as Nothing, so runner fails.
Now I can suggest you to add explicit type:
This case works well.
Best regards,
Alexander Podkhalyuzin.
Another way to make a function return Unit is to omit the assignment
operator '=' before the opening brace '{', as in:
object Main {
def main(args: Array[String]) {
println("greeting")
}
}
Greetings
/// Odd Möller
"Alexander Podkhalyuzin" <no_reply@jetbrains.com> wrote in message
news:33044704.132491246945538510.JavaMail.clearspace@app8.labs.intellij.net...
>
>
>
>
>
Thanks!!