package org.devoxx.spark.lab.devoxx2015;

import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;

import java.nio.file.Path;
import java.nio.file.Paths;

public class FirstRDD {

    public static void main(String... args) {
        SparkConf conf = new SparkConf().setAppName("Workshop").setMaster("local[*]");
        JavaSparkContext sc = new JavaSparkContext(conf);

        Path path = Paths.get(FirstRDD.class.getResource("/ratings.txt").getPath());
        JavaRDD<String> lines = sc.textFile(path.toString());
        System.out.println("Lines count: " + lines.count());
    }
}
@@ -164,16 +164,37 @@
 ntext;%0A%0A
+import java.io.File;%0A
 import j
@@ -312,16 +312,58 @@
 args) %7B%0A
+        FirstRDD runner = new FirstRDD();%0A
         
@@ -411,16 +411,18 @@
 me(%22
-Workshop
+Sparky CDN
 %22).s
@@ -526,68 +526,41 @@
 h = 
-Paths
+runner
 .get
-(
 Fi
-rstRDD.class.getResource(%22/ratings.txt%22).getPath
+lePath(runner.getFile
 ());
@@ -688,10 +688,299 @@
 );%0A    %7D
+%0A%0A    private File getFile() %7B%0A        ClassLoader classLoader = getClass().getClassLoader();%0A        return new File(classLoader.getResource(%22ratings.txt%22).getFile());%0A    %7D%0A%0A    private Path getFilePath(File file) %7B%0A        Path path = Paths.get(file.toURI());%0A        return path;%0A    %7D
 %0A%7D

Fix #1 Windows support