cheeseng/scala-ide — pull request #4 by rlegendi (2012-05-18 14:04:46+00:00)
Title: Windows fix

# Fixed a bug that made the TestRunner view part inaccessable under Windows #

This is only a Windows-specific bug (I come accross it under Windows7x64). The problem is that the constructed `CLASSPATH` `URL` entries are created by hand, and `file://` is not recognized on Windows (it requires `file:/`).

I'm not sure if I solved the issue in the most practical way, but I hope it is acceptable.

So, the problem was that I merged in all your changes in this particular [pull request](https://github.com/scala-ide/scala-ide/pull/94) (thanks for the great contribution!). Everything was fine, except that the IDE didn't used the *TestRunner View*: it fired up a Swing-based ScalaTest frame.

!["No TestRunner View"](https://lh6.googleusercontent.com/-pQ8P1F-h2yQ/T7ZT4PKTvqI/AAAAAAAAAvI/6nEYa2w-tpQ/s800/2_days_of_work.png)

It took me quite a time to locate the problem, but in the end I found `ScalaTestLaunchDelegate.launchScalaTest()`. I debugged it and found that the URLs are invalid and I get a constant exception by `loader.loadClass("org.scalatest.tools.SocketReporter")` even though the latest build of ScalaTest was on the client's `CLASSPATH` (*scalatest_2.9.1-2.0.M1.jar*).

Here's a simple PoC code about the problem:

```scala
package test

import java.net.URLClassLoader
import java.net.URL

object LoadClass extends App {
val loader: ClassLoader = URLClassLoader.newInstance(
//Array(new URL("file:/C:/scalatest_2.9.1-2.0.M1.jar")), // [1]
Array(new URL("file://C:/scalatest_2.9.1-2.0.M1.jar")), // [2]
getClass.getClassLoader)
Class.forName("org.scalatest.WrapWith", true, loader)
}
```

Now, on my machine `[1]` runs without any problems, but `[2]` results in the following error (BTW `///` also works :-):

```
Exception in thread "main" java.lang.ClassNotFoundException: org.scalatest.WrapWith
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:789)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at test.LoadClass$delayedInit$body.apply(LoadClass.scala:22)
at scala.Function0$class.apply$mcV$sp(Function0.scala:34)
at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
at scala.App$$anonfun$main$1.apply(App.scala:60)
at scala.App$$anonfun$main$1.apply(App.scala:60)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
at scala.collection.immutable.List.foreach(List.scala:76)
at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:30)
at scala.App$class.main(App.scala:60)
at test.LoadClass$.main(LoadClass.scala:7)
at test.LoadClass.main(LoadClass.scala)
```