1

I'm currently reading this and I try to compile the very first example

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

I have Linux Mint 16. I set export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/. I've downloaded the "Linux/x86_64 (tgz)" version from http://x10-lang.org/x10-development/building-x10-from-source.html?id=248

I've tried to compile it like this:

$ ./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

and this:

./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.

and this

./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.

and this:

./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)){'

How should I run / execute it?

1 Answer 1

1

The signature of the main method has changed between version 2.1 (on which the introduction you're reading was based) and version 2.4. The correct signature is:

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

A current version of "Hello World" (along with other examples) is included in the X10 distribution in x10.dist/samples . A more up-to-date introduction to X10 is available at http://x10.sourceforge.net/documentation/intro/latest/html/

3
  • Now I get Public type must be declared in .x10 file. Mar 11, 2014 at 5:51
  • That usually means the class name doesn't match the file name - could you please check whether that's the case? Mar 11, 2014 at 18:46
  • Yes, it was the case. Thank you! Mar 26, 2014 at 14:01

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.