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

ͨ¹ýJNI ʵÏÖ javaÓëC++Ö®¼äµÄÐÅÏ¢´«µÝ

¶¨ÒåÒ»¸önative ·½·¨£º
package ext;
import java.util.Hashtable;
public class TestJNI
{
   static
   {
       System.loadLibrary("dllfile");
   }
    public TestJNI()
    {
        Hashtable htable = new Hashtable();
        htable.put(1,2);
    }
    public native Hashtable getNameList();
    public static void main(String[] arg)
    {
        TestJNI tstJNI= new TestJNI();
        Hashtable htable= tstJNI.getNameList();
        System.out.println(htable.size());
    }
}
ͨ¹ý javah Éú³É Í·Îļþ ext_TestJNI.h
/* DO NOT EDIT THIS FILE - it is machine generated */
#include "jni.h"
/* Header for class ext_TestJNI */
#ifndef _Included_ext_TestJNI
#define _Included_ext_TestJNI
#ifdef __cplusplus
extern "C" {
#endif
/*
 * Class:     ext_TestJNI
 * Method:    getNameList
 * Signature: ()Ljava/util/Hashtable;
 */
JNIEXPORT jobject JNICALL Java_ext_TestJNI_getNameList
  (JNIEnv *, jobject);
#ifdef __cplusplus
}
#endif
#endif
ÔÚc++´´½¨Ò»¸ödynamic dllÏîÄ¿£¬²¢ÔÚ StdAfx.h ÖÐ include Í·Îļþ ext_TestJNI.h
StdAfx.h ´úÂ룺
 #if !defined(AFX_STDAFX_H__FAD3F2E4_D6E1_4011_9791_2256C4B0BDE6__INCLUDED_)
#define AFX_STDAFX_H__FAD3F2E4_D6E1_4011_9791_2256C4B0BDE6__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Insert your headers here
#define WIN32_LEAN_AND_MEAN        // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include "ext_TestJNI.h"
ÔÚ CPPÎļþÖж¨Òå  ·½·¨ÊµÏÖ£º
 CPP´úÂ룺
#include "stdAfx.h&


Ïà¹ØÎĵµ£º

javaÖеĹ¹Ôì·½·¨

1.¹¹Ôì·½·¨£ºÊÇÖ¸·½·¨ÃûÓëÀàÃûÏàͬµÄ·½·¨£¬°üÀ¨“×Ô¶¨Òå¹¹Ôì·½·¨”ºÍ“ĬÈϵĹ¹Ôì·½·¨”
                  ÔÚ´´½¨¶ÔÏóʱ  Èç¹ûÀàÖÐÒѾ­×Ô¶¨ÒåÁ˹¹Ôì·½·¨  ÄÇô±ØÐëʹÓøù¹Ôì·½·¨À´¹¹Ôì¶ÔÏó£»Èç¹ûÀ ......

javaÖеķ½·¨ÖØÔØ

1.·½·¨ÖØÔØ£ºÊÇÖ¸ÔÚÒ»¸öÀàÖÐÓжà¸ö·½·¨µÄÃû×ÖÏàͬ£¬µ«ÕâЩ·½·¨µÄ²ÎÊý±ØÐ벻ͬ£¬¼´ÒªÃ´ÊDzÎÊýµÄ¸öÊý²»Í¬£¬ÒªÃ´ÊDzÎÊýµÄÀàÐͲ»Í¬
                  ×¢Ò⣺ÔÚ·½·¨ÖØÔØÖУ¬·½·¨µÄ·µ»ØÀàÐͺͲÎÊýµÄÃû×Ö²»²ÎÓë±È½Ï
2.·½·¨ÖвÎÊýµÄ´«Öµ£ ......

java¶ÁÈ¡ExcelÎļþ

http://www.andykhan.com/jexcelapi/¿ÉÒÔÏÂÔØµ½µÚÈý·½jxl.jar°ü£¬²¢ÇÒexcelÒª±£´æÎª2003»òÒÔǰµÄ°æ±¾
package com.excel;
// 1 Îļþ¶ÔÏó 2¹¤×÷²¾¶ÔÏó 3 µ¥Ôª¸ñ¶ÔÏó¡£
//ÏàÓ¦µÄÔÚJXLÖоÍÓÐWorkbook£¬Sheet £¬Cell ¡£
import java.io.*;
import jxl.*;
public class GetExcelValues3 {
public static void main(Strin ......

Java ʼþ´¥·¢½Ó¿Ú»Øµ÷·½·¨

Æä¼¼ÇɾÍÊÇ£º¶¨ÒåÒ»¸ö¼òµ¥½Ó¿Ú£¬²¢ÔڸýӿÚÖÐÉùÃ÷ÎÒÃÇÒªµ÷Óõķ½·¨£¬Ò»°ã¿ÉÒÔÓ¦ÓÃÔÚ¼üÅÌÊó±êʼþ¸ú×Ù¡£
ÏÂÃæ¾ÙÒ»¸öÀý×Ó£º
¼Ù¶¨ÎÒÃÇÏ£ÍûÔÚij¸öʼþ·¢ÉúʱµÃµ½Í¨Öª¡£ÎÒÃÇ¿ÉÒÔ¶¨ÒåÒ»¸ö½Ó¿Ú£º
/*
 * ÔÚij¸öʼþ·¢ÉúʱµÃµ½Í¨Öª£®
 */
public interface InterestingEvent {
¡¡¡¡ public void interestingEvent() ......

Java ¶àÏß³Ì

1. ´´½¨Ị̈߳¨¼Ì³ÐThreadºÍʵÏÖrunnable½Ó¿Ú£© class SubThread {
private class InnerThread extends Thread {
@Override
public void run() {
System.out.println(Thread.currentThread().getName());
super.run();
}
}
public Thread getThread() {
return new InnerThread();
}
}
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ