Calling .NET assembly from Java: JVM crashes

后端 未结 4 961
北恋
北恋 2020-12-29 11:15

I have a third party .NET Assembly and a large Java application. I need to call mothods provided by the .NET class library from the Java application. The assembly is not COM

4条回答
  •  [愿得一人]
    2020-12-29 11:57

    OK, the mystery is solved.

    The JVM crash is caused by unhandled System.IO.FileNotFoundException. The exception is thrown because the .NET assembly is searched in the folder where the calling exe file resides.

    1. The mscorlib.dll is in the Global Assembly Cache, so it works.
    2. The CPP application exe is in the same folder as the assembly, so it works also.
    3. The cslib.dll assembly is NEITHER in the folder of java.exe, NOR in the GAC, so it doesn't work.

    It seems my only option is to install the .NET assembly in GAC (the third-party dll does have a strong name).

提交回复
热议问题