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
相关文档:
1. 在出现grub画面时,用上下键选中你平时启动linux的那一项(别选dos哟),然后按e键
2. 再次用上下键选中你平时启动linux的那一项(类似于kernel /boot/vmlinuz-2.4.18-14 ro root=LABEL=/),然后按e键
3. 修改你现在见到的命令行,加入single,结果如下:
kernel /boot/vmlinuz-2.4.18-14 single ro root=LABEL=/
4 ......
转载本站文章请注明,转载自:扶凯[http://www.php-oa.com]
本文链接: http://www.php-oa.com/2009/02/03/iostat.html
以前一直不太会用这个参数。现在认真研究了一下iostat,因为刚好有台重要的服务器压力高,所以放上来分析一下.下面这台就是IO有压力过大的服务器
$iostat -x 1
Linux 2.6.33-fukai (fukai-lap ......
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@ ......
在linux中,惊群现象已经消失了的,我们可以看 http://simohayha.javaeye.com/blog/561424 ,但是当我们在开发服务器时候,需要使用epoll,发现一个问题,就是当一个请求过来的时候,发现有的时候被唤起的进程不止一个,看下面的程序:#include <sys/socket ......
宏内核与微内核
(
P2
)
宏内核(
Monolithic
Kernel
)操作系统的
kernel
中既包含管理用户进程的组件,又包含向用户进程提供服务的组件(例如进程间通信、设备驱动程序、文件系统等),从而使得用户进程与操作系统
kernel
间存在着典型的
client/server
模型,但是这 ......