It is necessary to refer to the function exported from the dynamic library in the JAVA application. On cross-platform spit. And don’t say why it is JAVA and not C ++ or C #, there are some reasons to use this particular language.
package javawinapi; import java.io.*; public class JavaWinAPI { native static int sum(int x, int y); public static void main(String[] args) { // TODO code application logic here System.loadLibrary("sumka"); // загружаем библиотеку sumka.dll System.out.println(sum(2, 3)); } }
There is only one function in the library. The compiler returns:
Exception in thread "main" java.lang.UnsatisfiedLinkError: javawinapi.JavaWinAPI.sum(II)I at javawinapi.JavaWinAPI.sum(Native Method) at javawinapi.JavaWinAPI.main(JavaWinAPI.java:24) Java Result: 1 СБОРКА УСПЕШНО ЗАВЕРШЕНА (общее время: 0 секунд)