嘗試調用TestCode.dll庫中的String _SetUserName(String name)方法,方法返回設定的name
基本介紹
- 軟體名稱:JNA使用小事例
- 軟體平台:jdk1.6
- 軟體語言:java
public class JavaApplication1 { public JavaApplication1() { } /** * @param args the command line arguments */ public interface TestLibrary extends Library { TestLibrary INSTANCE = (TestLibrary) Native.loadLibrary("TestCode", TestLibrary.class); public String _SetUserName(String value); } public static void main(String[] args) { try { System.out.println(TestLibrary.INSTANCE._SetUserName("111")); } catch (Exception e) { e.printStackTrace(); } }}