Jetbrains提供了一些文档,但我找不到如何运行Kotlin的编译类文件.
hello.kt:
fun main(args : Array<String>) {
println("Hello, world!")
}
Run Code Online (Sandbox Code Playgroud)
编译:
$ kotlinc -out dist -src hello.kt
$ ls dist
namespace.class
$ java dist/namespace
Exception in thread "main" java.lang.NoClassDefFoundError: dist/namespace (wrong name: namespace)
$ java -jar /usr/local/kotlin/lib/kotlin-runtime.jar
Failed to load Main-Class manifest attribute from
/usr/local/kotlin/lib/kotlin-runtime.jar
Run Code Online (Sandbox Code Playgroud)
如何运行Kotlin程序?
可以通过__LINE__Ruby或Perl 获取当前行号.例如:
print "filename: #{__FILE__}, line: #{__LINE__}"
Run Code Online (Sandbox Code Playgroud)
Groovy中是否有相同的功能?