Permalink
Browse files

Initial attempt at running stuff from Java

  • Loading branch information...
1 parent fabcc82 commit 94e8607922d5228bb24756dd462e2fbe42a3da88 @mateiz mateiz committed Jan 24, 2012
Showing with 28 additions and 3 deletions.
  1. +5 −2 core/src/main/scala/spark/SparkContext.scala
  2. +13 −0 examples/src/main/java/spark/examples/JavaTest.java
  3. +10 −1 run
@@ -33,9 +33,12 @@ import spark.broadcast._
class SparkContext(
master: String,
frameworkName: String,
- val sparkHome: String = null,
- val jars: Seq[String] = Nil)
+ val sparkHome: String,
+ val jars: Seq[String])
extends Logging {
+ def this(master: String, frameworkName: String) =
+ this(master, frameworkName, null, Nil)
+
// Ensure logging is initialized before we spawn any threads
initLogging()
@@ -0,0 +1,13 @@
+package spark.examples;
+
+import spark.*;
+
+class JavaTest {
+ public static void main(String[] args) {
+ System.out.println("Hello world\n");
+
+ SparkContext ctx = new SparkContext("local", "JavaTest");
+ RDD<String> rdd = ctx.textFile("LICENSE", 1);
+ System.out.println(rdd.count());
+ }
+}
View
@@ -67,4 +67,13 @@ else
SCALA=scala
fi
-exec $SCALA -cp $CLASSPATH "$@"
+# To write the classpath out:
+#echo $CLASSPATH
+
+# To run java:
+SCALA_HOME=/usr/local/scala/lib
+CLASSPATH+=":$SCALA_HOME/scala-library.jar:$SCALA_HOME/scala-compiler.jar"
+exec java -cp $CLASSPATH "$@"
+
+# To run scala:
+#exec $SCALA -cp $CLASSPATH "$@"

0 comments on commit 94e8607

Please sign in to comment.