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

javaµ÷ÓÃC/C++дµÄdll

JavaÓïÑÔ±¾Éí¾ßÓпçƽ̨ÐÔ£¬Èç¹ûͨ¹ýJavaµ÷ÓÃDLLµÄ¼¼Êõ·½±ãÒ×Óã¬Ê¹ÓÃJava¿ª·¢Ç°Ì¨½çÃæ¿ÉÒÔ¸ü¿ìËÙ£¬Ò²ÄÜ´øÀ´¿çƽ̨ÐÔ¡£
Javaµ÷ÓÃC/C++дºÃµÄDLL¿âʱ£¬ÓÉÓÚ»ù±¾Êý¾ÝÀàÐͲ»Í¬¡¢Ê¹ÓÃ×Ö½ÚÐòÁпÉÄÜÓвîÒ죬ËùÒÔÔÚ²ÎÊý´«µÝ¹ý³ÌÖÐÈÝÒ׳öÏÖÎÊÌ⣬DLLÖпÉÄÜÐèÒª×öÏàÓ¦µÄת»»¡£
ʹÓÃJavaµ÷ÓÃDLL¶¯Ì¬Á´½Ó¿âµÄ·½°¸Í¨³£ÓÐÈýÖÖ£ºJNI, Jawin, Jacob. ÆäJNI(Java Native Interface)ÊÇJavaÓïÑÔ±¾ÉíÌṩµÄµ÷Óñ¾µØÒѱàÒëµÄº¯Êý¿âµÄ·½·¨£¬±¾Éí¾ßÓпçƽ̨ÐÔ£¬¿ÉÒÔÔÚ²»Í¬µÄ»úÆ÷Éϵ÷Óò»Í¬µÄ±¾µØ¿â¡£JawinºÍJacob¶¼ÊÇsourceforge.netµÄ¿ªÔ´ÏîÄ¿£¬¶¼ÊÇ»ùÓÚJNI¼¼ÊõµÄÒÀÀµWindowsµÄʵÏÖ£¬Ê¹µÃÔÚWindowsƽ̨ÏÂʹÓÃCOMºÍDLLµÄ¸ü¼Ó·½±ã¡£
    ÏÂÃ棬ÎÒÃÇÀ´Ïêϸ½éÉÜÒ»ÏÂʹÓÃJNIÀ´ÊµÏÖJavaÓëC/C++Ö®¼äµÄµ÷Óá£
Ò»¡¢  JNI¼ò½é
JNIÊÇJava Native InterfaceµÄËõд¡£´ÓJava 1.1¿ªÊ¼£¬Java Native Interface(JNI)±ê×¼³ÉΪjavaƽ̨µÄÒ»²¿·Ö£¬ËüÔÊÐíJava´úÂëºÍÆäËûÓïÑÔдµÄ´úÂë½øÐн»»¥¡£JNIÒ»¿ªÊ¼ÊÇΪÁ˱¾µØÒѱàÒëÓïÑÔ£¬ÓÈÆäÊÇCºÍC++¶øÉè¼ÆµÄ£¬µ«ÊÇËü²¢²»·Á°­ÄãʹÓÃÆäËûÓïÑÔ£¬Ö»Òªµ÷ÓÃÔ¼¶¨ÊÜÖ§³Ö¾Í¿ÉÒÔÁË¡£
sunÏà¹ØÎĵµ£ºhttp://java.sun.com/j2se/1.5.0/docs/guide/jni/spec/jniTOC.html
 
¶þ¡¢  ¼òµ¥²½Öè
µÚÒ»²½£º
±àдJavaÀ࣬ÓøÃÀཫDLL¶ÔÍâÌṩµÄº¯Êý·þÎñ½øÐÐÉùÃ÷£¬ÆäÖеÄJava·½·¨¾ùÉùÃ÷Ϊnative£¬Æä·½·¨Ç©Ãû¿ÉÒÔ×Ô¶¨Ò壬²»ÓÃʵÏÖº¯ÊýÌå¡£Ò»¸öÀý×ÓÈçÏ£ºDllTest.java
public class DllTest
{
     static
     {
         System.loadLibrary("chat");
     }
 
     public static native int connect(int i);
     public static native String getstring(String src);
 
     public static void main(String[] args)
     {
         DllTest dllTest = new DllTest();
         System.out.println(dllTest.connect(5));
         System.out.println(dllTest.getstring("java send"));
     }
}
ÆäÖУ¬chatΪ¸Ã¶¯Ì¬¿âµÄÃû×Ö£¬ËüµÄÀ©Õ¹Ãû×Ö¿ÉÒÔ²»ÓÃд³öÀ´£¬¾¿¾


Ïà¹ØÎĵµ£º

java µ÷ÓÃÃüÁî ±¸·ÝmysqlÊý¾Ý¿â

 ´úÂëÈçÏ£º
  1  String command  =   " cmd /c C:/Program Files/MySQL/MySQL Server 5.0/bin>mysqldump -h localhost -u root -p aijia > E:/aijia.dmp " ;
  2      try    {
  3     Process process& ......

javaÉè¼Æģʽ

1¡¢FACTORY£¨¹¤³§Ä£Ê½£©
2¡¢BUILDER£¨½¨Ôìģʽ£©
3¡¢FACTORY METHOD£¨¹¤³§·½·¨Ä£Ê½£©
4¡¢PROTOTYPE£¨Ô­Ê¼Ä£ÐÍģʽ£©
5¡¢SINGLETON£¨µ¥Àýģʽ£©
6¡¢ADAPTER£¨ÊÊÅäÆ÷ģʽ£©
7¡¢BRIDGE£¨ÇÅÁºÄ£Ê½£©
8¡¢COMPOSITE£¨ºÏ³Éģʽ£©
9¡¢DECORATOR£¨×°ÊÎģʽ£©
10¡¢FACADE£¨ÃÅÃæģʽ£©
11¡¢FLYWEIGHT£¨ÏíԪģʽ£© ......

JavaÐéÄâ»ú ºÍ javaÐéÄâ»úϵĽø³Ì

Ò»¡¢Ê²Ã´ÊÇJavaÐéÄâ»ú
     µ±Äã̸µ½JavaÐéÄâ»úʱ£¬Äã¿ÉÄÜÊÇÖ¸£º
     1¡¢³éÏóµÄJavaÐéÄâ»ú¹æ·¶
     2¡¢Ò»¸ö¾ßÌåµÄJavaÐéÄâ»úʵÏÖ
     3¡¢Ò»¸öÔËÐеÄJavaÐéÄâ»úʵÀý
¶þ¡¢JavaÐéÄâ»úµÄÉúÃüÖÜÆÚ
     Ò»¸öÔËÐÐ ......

Serializable javaÐòÁл¯

Bean Serializable Interface µÄ½Ó¿ÚÈÃBEAN¿ÉÒÔ´®Ðл¯£¬½«Æä±ä³ÉÒ»¸ö¿É±£´æΪÒÔºóʹÓõĶþ½øÖÆÁ÷¡£µ±Ò»¸öBEAN±»ÏµÁл¯µ½´ÅÅÌÉÏ»òÕßÆäËûÈκεط½£¬Æä״̬±»±£´æÆðÀ´£¬ÆäÖеÄÊôÐÔÖµÒ²²»»á¸Ä±ä¡£ÔÚBEANµÄ¹æ·¶ÖУ¬JSP²¢Ã»ÓÐÒªÇóBEANʵÏÖSerializable½Ó¿Ú¡£µ«ÊÇ£¬Èç¹ûÄúÏ£Íû×Ô¼º¿ØÖÆÄúËù´´½¨µÄ×é¼þµÄserialization½ø³Ì£¬»òÕßÄúÏë ......

³£¼ûË㷨ѧϰ¼°ÆäJavaʵÏÖ

package org.bupt.test;
import java.util.ArrayList;
class MyResource {
    ArrayList<Integer> arrList= new ArrayList<Integer>();
    public MyResource(ArrayList<Integer> arrList) {
        this.arrList = arrList;
&nbs ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ