Scala on.Net HelloWorld

After README at https://github.com/magarciaEPFL/scaladotnet to create a Windows exe for a simple Hello World application:

package hello.world object Main { def main(args: Array[String]) { println("Hello, World!") } } 

Built .exe with a command from 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 

When using Windows 7 Pro, 64 bit, I get this error when trying to start:

C: \ test \ Bin> HelloWorld.exe

Unhandled exception: System.IO.FileNotFoundException: Failed to load file or assembly 'scalalib, Version = 0.0.0.0, Culture = neutral, PublicKeyToken = null' or one of its dependencies. The system cannot find the specified file. in Main (String [] args)

The Scala.Net compiler directory is directly on the way, but it seems that HelloWorld.exe cannot find and load the scalalib.dll file located in this directory. According to the comments below, copying HelloWorld.exe directly to the C: \ scala.net directory and executing from there is performed as expected. But, putting the .exe file in another directory, and the C: \ scala.net directory as part of PATH, does not.

What's wrong?

+6
source share
1 answer

The .NET Framework does not follow Win32 in using the% PATH% environment variable to host assemblies.

Short answer: if it is not in the same folder, it must be in the GAC, or it will not be found.

Also see this question .

+6
source

Source: https://habr.com/ru/post/921849/


All Articles