シンプルな .NET を作成するためのこのコードがあります.dll
。のみを返しますint
。
ただし、Java 内では動作しません。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ReturnINT
{
public class ReturnINT
{
public static int RetornaInteiro ()
{
try
{
int number = 2;
return number;
}
catch (Exception)
{
return 1;
}
}
}
}
Java内からメソッドを呼び出すにはどうすればよいですか?
JNI を使用すると、Java で次のエラーが発生します。
Exception in thread "main" java.lang.UnsatisfiedLinkError: Dll.RetornaInteiro()V
at Dll.RetornaInteiro(Native Method)
at Dll.main(Dll.java:27)