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系统么?你是Linux系统的应用者么?如果你要学习linux,你可能会遇到Linux Shell自动交互问题,这里将介绍Linux Shell自动交互的解决方法,在这里拿出来和大家分享一下。
一、背景
shell脚本在处理自动循环或大的任务方面可节省大量的时间,通过创建一个处理任务的命令清单,使用变量、条件、算术和循环等方 ......
author:skate
time:2010-05-24
以前也用过linux的远程图形界面管理程序x-win32,地址如下:
http://blog.csdn.net/wyzxg/archive/2007/09/10/1779148.aspx
今天介绍在介绍一个图形管理软件vnc,简单配置如下
vnc服务端os版本:centos4.7
vnc client: nvc viewer客户端
1.检查vnc服务器是否安装
[root@ ......
vi编辑命令
进入编辑模式 --> i (insert) 或者 a (append)
进入命令模式 --> Esc
命令模式常用操作:
删除一行 --> dd
复制一行 --> yy
粘贴 --> p ( yy 和 p 是结合使用)
替换 --> :s/oldwords/newwords 替换当前行 :%s/oldwords/newwords 替换所有
注:特殊字符用"\"转义&n ......
从文件内容查找匹配指定字符串的行:
$ grep "被查找的字符串" 文件名
从文件内容查找与正则表达式匹配的行:
$ grep –e “正则表达式” 文件名
查找时不区分大小写:
$ grep –i "被查找的字符串" 文件名
查找匹配的行数:
$ grep -c "被查找的字符串" 文件名
......