Following the README at https://github.com/magarciaEPFL/scaladotnet to create a Windows exe for a simple "Hello World" app:
package hello.world
object Main {
def main(args: Array[String]) {
println("Hello, World!")
}
}
Built .exe with the command from the README:
scalacompiler.exe ^
-d C:\test\bin ^
-target:exe ^
-Ystruct-dispatch:no-cache ^
-Xassem-name HelloWorld.exe ^
-Xassem-extdirs C:\scala.net ^
-Xshow-class hello.world.Main ^
C:\test\src\HelloWorld.scala
While using Windows 7 Pro, 64bit, I receive this error when attempting a run:
C:\test\bin>HelloWorld.exe
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'scalalib, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. at Main(String[] args)
The Scala .Net compiler directory is directly in the path, yet it appears that the HelloWorld.exe is unable to find and load the scalalib.dll that is in that directory. As per the comments below, copying the HelloWorld.exe directly into the C:\scala.net directory, and executing from there, works as expected. But, placing the .exe into another directory, and the C:\scala.net dir as part of the PATH, does not.
What is wrong?
The .NET Framework does not follow Win32 in using the %PATH% environment variable for locating assemblies.
The short answer is: If it's not in the same folder, then it needs to be in the GAC, or it won't be found.
Also, see this question.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With