I'm trying to use the following to read input from a text file

============================
import x10.io.Console;
import x10.util.*;
import x10.io.*;

public class Tester
{
        public static def main(args:Rail[String])
        {
                try
                {
                        val inputFile = new File("./param_file.txt");
                        val input = inputFile.openRead();

                        for( l in input.lines()) {
                                Console.OUT.println(l);
                        }
                }catch(e:IOException)
                        {
                                Console.OUT.println("Problem:");
                                e.printStackTrace(Console.ERR);
                        }
        }
}
=====================================

but receive the following

=====================================

$ x10 Tester
java.lang.ClassCastException
        at x10.io.ReaderIterator$1.cast(ReaderIterator.java:123)
        at x10.io.ReaderIterator.next(ReaderIterator.java:128)
        at Tester.main(Tester.java:89)
        at Tester$Main$1.apply(Tester.java:48)
        at x10.runtime.Activity.now(Activity.java:214)
        at x10.runtime.Activity.run(Activity.java:131)
        at x10.runtime.Worker$3.apply(Worker.java:308)
        at x10.runtime.impl.java.Runtime.runAt(Runtime.java:96)
        at x10.runtime.Worker.loop(Worker.java:303)
        at x10.runtime.Runtime.start(Runtime.java:141)
        at Tester$Main.main(Tester.java:35)
        at x10.runtime.impl.java.Runtime.run(Runtime.java:46)
        at java.lang.Thread.run(Thread.java:613)

=====================================


Any suggestions?

Jim



------------------------------------------------------------------------------
_______________________________________________
X10-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to