Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Java Native Interface ÈëÃÅʾÀý

¼øÓÚÍøÉÏËѵ½µÄ¶¼ÊÇ»ùÓÚjdk1.4»òÒÔǰ°æ±¾£¬¶øÇÒ±¾µØ¿âÓõÄÊÇCÓïÑÔ¡£¶øÏÖÔÚÊÇ»ùÓÚC++£¬ËùÒÔ¸üмǼÈçÏ£º
µÚÒ»²½£º´´½¨JavaÔ´ÂëÎļþ
public class Hello{
        static{
                System.loadLibrary("Hello");
        }
        public Hello(){
        }
        public native void sayHello(String strName);
        public static void main(String[] args){
                Hello hello = new Hello();
                hello.sayHello("fuye");
        }
}
µÚ¶þ²½£º±àÒë
javac Hello.java
µÚÈý²¿£ºÉú³ÉC++ÎļþÍ·
javah Hello
Hello.hÎļþÄÚÈÝÈçÏ£º
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class Hello */
#ifndef _Included_Hello
#define _Included_Hello
#ifdef __cplusplus
extern "C" {
#endif
/*
 * Class:     Hello
 * Method:    sayHello
 * Signature: (Ljava/lang/String;)V
 */
JNIEXPORT void JNICALL Java_Hello_sayHello
  (JNIEnv *, jobject, jstring);
#ifdef __cplusplus
}
#endif
#endif
µÚËIJ½£ºÐ½¨C++ʵÏÖÎļþ
#include "Hello.h"
#include <stdio.h>
JNIEXPORT void JNICALL Java_Hello_sayHello(JNIEnv * env, jobject arg, jstring instring){
        printf("This is my first jni program\n");
}
µÚÎå²½£º ±àÒ룬Á¬½Ó³É±¾µØ¿â
1¡¢Éú³ÉHello.o
g++ -I /usr/local/dev/java/jdk1.5.0_16/include/ -I /usr/local/dev/java/jdk1.5.0_16/include/linux/ -c Hello.cpp
2¡¢Éú³ÉlibHello.so.1.0
g++ -shared -W1,-soname,libHell


Ïà¹ØÎĵµ£º

´«ÖDz¥¿ÍjavaÅàѵ JavaWeb

½ñÌì¸øÎÒÃÇÉϿεÄÊÇ·ëÍþÀÏʦ£¬ÀÏʦÒÔǰ¹¤×÷µÄ¹«Ë¾ÊǶÔÈÕÈí¼þ¿ª·¢µÄ£¬Óн«½üÊ®ÄêµÄ¹¤×÷¾­ÑéÁË£¬ÖÚËùÖÜÖª£¬ÈÕ±¾È˶Թ¤×÷ÒªÇóÊÇÊ®·ÖÑϽ÷µÄ£¬¾ÝÀÏʦËù˵£¬ÒÔǰÔÚ¹«Ë¾±àÂëµÄʱºòÒªÇóÊÇÒ»ÐдúÂëÒ»ÐÐ×¢ÊÍ£¬Èç¹ûûÓÐ×¢Ê͵ϰÔÚÉóºËµÄʱºòÊDz»»áͨ¹ýµÄ£¬Ã»ÓÐ×¢ÊÍÊǻᱻ°´ÕÕbug´¦ÀíµÄ£¬ËùÒÔÏÖÔÚÀÏʦÉÏ¿ÎÏÖ³¡±àÂëµÄʱºòÒ²ÊÇÐÐÐÐдעÊÍ£ ......

java Á¬½Ó sql 2005 µÄ·½·¨

java Á¬½Ó sql 2005 µÄ·½·¨£º
 1¡£µ½Î¢Èí¹Ù·½ÍøÕ¾ÏÂÔØ2005µÄjdbc²¢½âѹ£¬»ñµÃÎļþsqljdbc.jar
2¡£¸´ÖÆÎļþsqljdbc.jarµ½jdkĿ¼\jdk1.5\jre\lib\extÏ¡£
 3¡£¿ªÊ¼-¡µ³ÌÐò-¡µsql server 2005-¡µÅäÖù¤¾ß-¡µSQL Server Configuration Manager¡£Æô¶¯sql 2005·þÎñ¡£
µã»÷ sql server2005ÍøÂçÅäÖýڵ㣬²¢Ñ¡ÖÐ&rd ......

Java³õѧÕߣºÍ¼Êé¹ÜÀíС¹¤¾ß´úÂë

1.Welcome.java
import java.util.Date;
import java.util.Scanner;

public class Welcome {
/**
* @param args
* @throws IOException
*/
public static void main(String[] args){
// TODO Auto-generated method stub

System.out.println("Welcome to vis ......

Java´®¿Ú±à³Ì2

    ÔٴδÓÍøÉϲéѯ£¬Ëѵ½ÁËRXTXcomm.jar°ü±È½ÏºÃ£¬ÊÇ·â×°ÁËcomm.jarµÄ·½·¨¡£
    °²×°£º
    1.copy rxtxSerial.dll to [JDK-directory]\jre\bin\rxtxSerial.dll
    2.copy RXTXcomm.jar to [JDK-directory]\jre\lib\ext\RXTXcomm.jar
  &nbs ......

Java¶ÔÏóµÄÐòÁл¯ºÍ·´ÐòÁл¯Êµ¼ù

µ±Á½¸ö½ø³ÌÔÚ½øÐÐÔ¶³ÌͨÐÅʱ£¬±Ë´Ë¿ÉÒÔ·¢Ë͸÷ÖÖÀàÐ͵ÄÊý¾Ý¡£ÎÞÂÛÊǺÎÖÖÀàÐ͵ÄÊý¾Ý£¬¶¼»áÒÔ¶þ½øÖÆÐòÁеÄÐÎʽÔÚÍøÂçÉÏ´«ËÍ¡£·¢ËÍ·½ÐèÒª°ÑÕâ¸öJava¶ÔÏóת»»Îª×Ö½ÚÐòÁУ¬²ÅÄÜÔÚÍøÂçÉÏ´«ËÍ£»½ÓÊÕ·½ÔòÐèÒª°Ñ×Ö½ÚÐòÁÐÔÙ»Ö¸´ÎªJava¶ÔÏó¡£
¡¡¡¡°ÑJava¶ÔÏóת»»Îª×Ö½ÚÐòÁеĹý³Ì³ÆÎª¶ÔÏóµÄÐòÁл¯¡£
¡¡¡¡°Ñ×Ö½ÚÐòÁлָ´ÎªJava¶ÔÏóµÄ¹ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ