易截截图软件、单文件、免安装、纯绿色、仅160KB

Linux JNI实例及其JNI程序设计模板

简单实例说明待补充,实例源码可在此链接下载http://d.download.csdn.net/down/2389895/sanlinux
jniNative.cpp
#include "jniNative.h"
#include "mymain.h"
#include <stdio.h>
JNIEXPORT void JNICALL Java_HelloWorld_print(JNIEnv *env, jobject arg, jstring instring)
{
    const char *str = (const char *)env->GetStringUTFChars(instring, JNI_FALSE);
    printf("HELLO,%s\n",str);
    env->ReleaseStringUTFChars(instring,str);
    return;
}
JNIEXPORT void JNICALL Java_HelloWorld_test(JNIEnv *env, jobject arg, jstring instring)
{
    const jbyte *str = (const jbyte *)env->GetStringUTFChars(instring, JNI_FALSE);
    test((const char *)str);
    env->ReleaseStringUTFChars(instring, (const char *)str);
    return;
}
jniNative.h
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class HelloWorld */
//javac HelloWorld.java
//javah HelloWorld
//Copy from HelloWorld.h
#ifndef _Included_HelloWorld
#define _Included_HelloWorld
#ifdef __cplusplus
extern "C" {
#endif
/*
 * Class:     HelloWorld
 * Method:    print
 * Signature: (Ljava/lang/String;)V
 */
JNIEXPORT void JNICALL Java_HelloWorld_print
  (JNIEnv *, jobject, jstring);
/*
 * Class:     HelloWorld
 * Method:    test
 * Signature: (Ljava/lang/String;)V
 */
JNIEXPORT void JNICALL Java_HelloWorld_test
  (JNIEnv *, jobject, jstring);
#ifdef __cplusplus
}
#endif
#endif
mymain.cpp
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "mymain.h"
void test(const char *str)
{
    char ch[50];
    int len = 0;
   
    strcat(ch,"Hello ");
&nbs


相关文档:

LINUX c++线程池框架

版权声明:原文地址及作者不详,如有侵权,请联系;
本文给出了一个通用的线程池框架,该框架将与线程执行相关的任务进行了高层次的抽象,使之与具体的执行任务无关。另外该线程池具有动态伸缩性,它能根据执行任务的轻重自动调整线程池中线程的数量。文章的最后,我们给出一个简单示例程序,通过该示例程序,我们会发现, ......

Linux shell

Linux 查看所有环境变量命令:expoert 和  env 。
               指定环境变量:echo $XXX,(XXX代表环境变量名)
更改环境变量值方法:
1.修改/etc/profile文件
例:在profile文件末尾加入:
JAVA_HOME=/usr/share/jdk1.5.0_05
P ......

linux下模拟键盘的几种方法

1、使用GTK中的GdkEvent
    GdkEvent *event;
    event = gdk_event_new (GDK_KEY_PRESS);              //按键按下
    event->key.send_event = TRUE;
    event->key.keyva ......

linux内核编译中的i2o选项

The Intelligent Input/Output (I2O) architecture allows hardware drivers to be split into two parts: an operating system specific module called the OSM and an hardware specific module called the HDM. The OSM can talk to a whole range of HDM's, and ideally the HDM's are not OS dependent. This allows f ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号