Repository: spark
Updated Branches:
  refs/heads/branch-1.1 23fd3e8b9 -> 359cd59d1


[SPARK-1919] Fix Windows spark-shell --jars

We were trying to add `file:/C:/path/to/my.jar` to the class path. We should 
add `C:/path/to/my.jar` instead. Tested on Windows 8.1.

Author: Andrew Or <andrewo...@gmail.com>

Closes #2211 from andrewor14/windows-shell-jars and squashes the following 
commits:

262c6a2 [Andrew Or] Oops... Add the new code to the correct place
0d5a0c1 [Andrew Or] Format jar path only for adding to shell classpath
42bd626 [Andrew Or] Remove unnecessary code
0049f1b [Andrew Or] Remove embarrassing log messages
b1755a0 [Andrew Or] Format jar paths properly before adding them to the 
classpath


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/359cd59d
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/359cd59d
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/359cd59d

Branch: refs/heads/branch-1.1
Commit: 359cd59d1517cbe32a6d6a27a1bf604b53eea08b
Parents: 23fd3e8
Author: Andrew Or <andrewo...@gmail.com>
Authored: Tue Sep 2 10:47:05 2014 -0700
Committer: Andrew Or <andrewo...@gmail.com>
Committed: Tue Sep 9 15:28:04 2014 -0700

----------------------------------------------------------------------
 .../main/scala/org/apache/spark/repl/SparkILoop.scala    | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/359cd59d/repl/src/main/scala/org/apache/spark/repl/SparkILoop.scala
----------------------------------------------------------------------
diff --git a/repl/src/main/scala/org/apache/spark/repl/SparkILoop.scala 
b/repl/src/main/scala/org/apache/spark/repl/SparkILoop.scala
index 65788f4..30f7364 100644
--- a/repl/src/main/scala/org/apache/spark/repl/SparkILoop.scala
+++ b/repl/src/main/scala/org/apache/spark/repl/SparkILoop.scala
@@ -14,6 +14,7 @@ import scala.tools.nsc.interpreter._
 import scala.tools.nsc.interpreter.{ Results => IR }
 import Predef.{ println => _, _ }
 import java.io.{ BufferedReader, FileReader }
+import java.net.URI
 import java.util.concurrent.locks.ReentrantLock
 import scala.sys.process.Process
 import scala.tools.nsc.interpreter.session._
@@ -186,8 +187,16 @@ class SparkILoop(in0: Option[BufferedReader], protected 
val out: JPrintWriter,
     require(settings != null)
 
     if (addedClasspath != "") settings.classpath.append(addedClasspath)
+    val addedJars =
+      if (Utils.isWindows) {
+        // Strip any URI scheme prefix so we can add the correct path to the 
classpath
+        // e.g. file:/C:/my/path.jar -> C:/my/path.jar
+        SparkILoop.getAddedJars.map { jar => new 
URI(jar).getPath.stripPrefix("/") }
+      } else {
+        SparkILoop.getAddedJars
+      }
     // work around for Scala bug
-    val totalClassPath = SparkILoop.getAddedJars.foldLeft(
+    val totalClassPath = addedJars.foldLeft(
       settings.classpath.value)((l, r) => ClassPath.join(l, r))
     this.settings.classpath.value = totalClassPath
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to