1

我目前正在阅读这篇文章,并尝试编译第一个示例

// file HelloWorld.x10
public class HelloWorld {
    public static def main(args: Array[String](1)){
        x10.io.Console.OUT.println("Hello, World");
    }
}

我有 Linux Mint 16。我设置了export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/. 我已经从http://x10-lang.org/x10-development/building-x10-from-source.html?id=248下载了“Linux/x86_64 (tgz)”版本

我试图像这样编译它:

$ ./x10 HelloWorld.x10       
Error: Cannot load main class for HelloWorld.x10 with classpath .:/home/moose/Downloads/x10-2.4.2_linux_x86_64/stdlib/x10.jar:/home/moose/Downloads/x10-2.4.2_linux_x86_64/lib/commons-math3-3.2.jar:/home/moose/Downloads/x10-2.4.2_linux_x86_64/lib/commons-logging-1.1.3.jar

和这个:

./x10c HelloWorld.x10
/home/moose/Downloads/x10-2.4.2_linux_x86_64/bin/HelloWorld.x10:3: Could not find type "Array(x10.lang.Long)".
1 error.

和这个

./x10c++ HelloWorld.x10
/home/moose/Downloads/x10-2.4.2_linux_x86_64/bin/HelloWorld.x10:3: Could not find type "Array(x10.lang.Long)".
1 error.

和这个:

./runx10 HelloWorld.x10
/home/moose/Downloads/x10-2.4.2_linux_x86_64/bin/HelloWorld.x10: line 1: //: Is a directory
/home/moose/Downloads/x10-2.4.2_linux_x86_64/bin/HelloWorld.x10: line 2: public: command not found
/home/moose/Downloads/x10-2.4.2_linux_x86_64/bin/HelloWorld.x10: line 3: syntax error near unexpected token `('
/home/moose/Downloads/x10-2.4.2_linux_x86_64/bin/HelloWorld.x10: line 3: `    public static def main(args: Array[String](1)){'

我应该如何运行/执行它?

4

1 回答 1

1

main 方法的签名在 2.1 版(您正在阅读的介绍所基于)和 2.4 版之间发生了变化。正确的签名是:

public static def main(args:Rail[String])

当前版本的“Hello World”(以及其他示例)包含在x10.dist/samples. 有关 X10 的最新介绍,请访问http://x10.sourceforge.net/documentation/intro/latest/html/

于 2014-03-11T02:48:58.860 回答