package com.ostrichmyself.jni;
public class Main {
/**
* @param args
*/
static{
System.loadLibrary("BasicJNI");
}
public static void main(String[] args) {
arrayTest();
}
public static void basicDLL()
{
BasicJNI bs = new BasicJNI();
System.out.println(bs.getBoolean(true));
System.out.println(bs.getDouble(1.15d));
System.out.println(bs.getInt(1));
System.out.println(bs.getString("helloworld ha"));
}
public static void arrayTest()
{
JNIArray ja = new JNIArray();
Structure[] structures = new Structure[]{new Structure("a1", 1111),
new Structure("a2", 222)};
structures = ja.processsStructures(structures);
for (int i = 0; i < structures.length; i++) {
System.out.println(structures[i].nameString);
}
}
public static void objectTest()
{
JNIObject joJniObject = new JNIObject();
String string = joJniObject.processString("abc");
System.out.println(string);
Structure structure = joJniObject.processObject(new Structure("aa", 12));
System.out.println(structure.number);
}
public static void testDll()
{
JNI jni = new JNI();
System.out.println(jni.getInt());
System.out.println(jni.getString());
System.out.println();
String[] stringArr = jni.getStringArr();
for (int i = 0; i < stringArr.length; i++) {
System.out.print(stringArr[i] + " ");
}
System.out.println();
Structure structure = jni.getStructure();
System.out.println(structure.nameString);
System.out.println(structure.number);
}
}
JNI 实例, 可以作为模板供初学者学习, 例子很详细
5星 · 超过95%的资源 需积分: 3 25 浏览量
2009-09-19
17:27:53
上传
评论
收藏 5KB RAR 举报
x-teamer团队
- 粉丝: 1206
- 资源: 47
最新资源
- note test a bc d e f g h
- MERGE.csv.zip
- 15白落梅:你是锦瑟我为流年:三毛的万水千山-3491776.mobi
- 微信小程序源码 实现 城市切换 demo 根据城市首字母排序城市 选择城市
- 12因为懂得 所以慈悲-张爱玲的倾城往事 (白落梅经典散文系列)-3321089.mobi
- 基于 C# 实现的串口温度监控软件
- 基于STM32F103RBT6单片机+SIM868自动收货机主控板硬件(原理图+PCB)工程文件.zip
- 微信小程序源码 车源宝 二手车交易平台 源码下载
- 专注于在线教育领域,打造更好的网课系统,网校系统,知识付费系统
- ADM487EARZ-REEL7 产品规格书pdf
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
- 1
- 2
- 3
- 4
前往页