JAVAµÄ¿çƽ̨µÄÌØÐÔÉîÊÜjava³ÌÐòÔ±ÃǵÄϲ°®,µ«ÕýÊÇÓÉÓÚËüΪÁËʵÏÖ¿çƽ̨µÄÄ¿µÄ,ʹµÃËüºÍ±¾µØ»úÆ÷µÄ¸÷ÖÖÄÚ²¿ÁªÏµ±äµÃºÜÉÙ,´ó´óÔ¼ÊøÁËËüµÄ¹¦ÄÜ,±ÈÈçÓëһЩӲ¼þÉ豸ͨÐÅ,ÍùÍùÒª»¨·ÑºÜ´óµÄ¾«Á¦È¥Éè¼ÆÁ÷³Ì±àд´úÂëÈ¥¹ÜÀíÉ豸¶Ë¿Ú,¶øÇÒÓÐһЩÉ豸³§ÉÌÌṩµÄÓ²¼þ½Ó¿ÚÒѾ¾¹ýÒ»¶¨µÄ·â×°ºÍ´¦Àí,²»ÄÜÖ±½ÓʹÓÃjava³ÌÐòͨ¹ý¶Ë¿ÚºÍÉ豸ͨÐÅ,ÕâÖÖÇé¿öϾ͵ÿ¼ÂÇʹÓÃjava³ÌÐòÈ¥µ÷ÓñȽÏÉó¤Í¬ÏµÍ³´ò½»µÀµÄµÚÈý·½³ÌÐò,´Ó1.1°æ±¾¿ªÊ¼µÄJDKÌṩÁ˽â¾öÕâ¸öÎÊÌâµÄ¼¼Êõ±ê×¼:JNI¼¼Êõ.
JNIÊÇJava Native Interface(Java±¾µØ½Ó¿Ú)µÄËõд,±¾µØÊÇÏà¶ÔÓÚjava³ÌÐòÀ´ËµµÄ,Ö¸Ö±½ÓÔËÐÐÔÚ²Ù×÷ϵͳ֮ÉÏ,Óë²Ù×÷ϵͳֱ½Ó½»»¥µÄ³ÌÐò.´Ó1.1°æ±¾µÄJDK¿ªÊ¼,JNI¾Í×÷Ϊ±ê׼ƽ̨µÄÒ»²¿·Ö·¢ÐÐ.ÔÚJNI³öÏֵijõÆÚÊÇΪÁËJava³ÌÐòÓë±¾µØÒѱàÒëÓïÑÔ,ÓÈÆäÊÇCºÍC++µÄ»¥²Ù×÷¶øÉè¼ÆµÄ,ºóÀ´¾¹ýÀ©Õ¹Ò²¿ÉÒÔÓëcºÍc++Ö®ÍâµÄÓïÑÔ±àдµÄ³ÌÐò½»»¥,ÀýÈçDelphi³ÌÐò.
ʹÓÃJNI¼¼Êõ¹ÌÈ»ÔöÇ¿ÁËjava³ÌÐòµÄÐÔÄܺ͹¦ÄÜ,µ«ÊÇËüÒ²ÆÆ»µÁËjavaµÄ¿çƽ̨µÄÓŵã,Ó°Ïì³ÌÐòµÄ¿ÉÒÆÖ²ÐԺͰ²È«ÐÔ,ÀýÈçÓÉÓÚÆäËûÓïÑÔ(ÈçC/C++)¿ÉÄÜÄܹ»ËæÒâµØ·ÖÅä¶ÔÏó/Õ¼ÓÃÄÚ´æ,JavaµÄÖ¸Õ밲ȫÐԵò»µ½±£Ö¤.µ«ÔÚÓÐЩÇé¿öÏÂ,ʹÓÃJNIÊÇ¿ÉÒÔ½ÓÊܵÄ,ÉõÖÁÊDZØÐëµÄ,ÀýÈçÉÏÃæÌáµ½µÄʹÓÃjava³ÌÐòµ÷ÓÃÓ²¼þ³§ÉÌÌṩµÄÀà¿âͬÉ豸ͨÐŵÈ,Ä¿Ç°Êг¡ÉϵÄÐí¶à¶Á¿¨Æ÷É豸¾ÍÊÇÕâÖÖÇé¿ö.ÔÚÕâ±ØÐëʹÓÃJNIµÄÇé¿öÏÂ,¾¡Á¿°ÑËùÓб¾µØ·½·¨¶¼·â×°ÔÚµ¥¸öÀàÖÐ,Õâ¸öÀàµ÷Óõ¥¸öµÄ±¾µØ¿âÎļþ,²¢±£Ö¤¶ÔÓÚÿÖÖÄ¿±ê²Ù×÷ϵͳ,¶¼¿ÉÒÔÓÃÌض¨ÓÚÊʵ±Æ½Ì¨µÄ°æ±¾Ìæ»»Õâ¸öÎļþ,ÕâÑùʹÓÃJNIµÃµ½µÄÒª±ÈʧȥµÄ¶àºÜ¶à.
ÏÖÔÚ¿ªÊ¼ÌÖÂÛÉÏÃæÌáµ½µÄÎÊÌâ,Ò»°ãÉ豸ÉÌ»áÌṩÁ½ÖÖÀàÐ͵ÄÀà¿âÎļþ,windowsϵͳµÄ»á°üº¬.dll/.h/.libÎļþ,¶ølinuxϵͳµÄ»á°üº¬.so/.aÎļþ,ÕâÀïÖ»ÌÖÂÛwindowsϵͳϵÄc/c++±àÒëµÄdllÎļþµ÷Ó÷½·¨.
ÎÒ°ÑÉ豸ÉÌÌṩµÄdllÎļþ³Æ֮ΪµÚÈý·½dllÎļþ,Ö®ËùÒÔ˵µÚÈý·½,ÊÇÒòΪJNIÖ±½Óµ÷ÓõÄÊÇ°´ËüµÄ±ê׼ʹÓÃc/c++ÓïÑÔ±àÒëµÄdllÎļþ,Õâ¸öÎļþÊÇ¿Í»§³ÌÐòÔ±°´ÕÕÉ豸ÉÌÌṩµÄ.hÎļþÖеÄÁгöµÄ·½·¨±àдµÄdllÎļþ,ÎÒ³Æ֮ΪµÚ¶þ·½dllÎļþ,ÕæÕýµ÷ÓÃÉ豸ÉÌÌṩµÄdllÎļþµÄÆäʵ¾ÍÊÇÕâ¸öµÚ¶þ·½dllÎļþ.µ½ÕâÀï,½â¾öÎÊÌâµÄ˼·ÒѾ²úÉúÁË,´ó¿®·Ö¿ÉÒÔ·ÖΪÈý²½:
1>±àдһ¸öjavaÀà,Õâ¸öÀà°üº¬µÄ·½·¨ÊÇ°´ÕÕÉ豸É
Java¿ª·¢ÖУ¬×îÖյijÌÐò·¢²¼Ò»°ãÊÇÒª´ò³Éjar°üÐÎʽµÄ£¬¶øÓÐһЩÅäÖÃÎļþÊÇ·ÅÔÚjarÀïÃæµÄ£¬ÕâÑùÔÚ×öFileÐÎʽµÄ¶Áȡʱ£¬¾Í»á·¢ÏÖ¶Á²»µ½ÏàÓ¦µÄÎļþ¡£ÏÂÃæÌṩһÖÖ½â¾ö·½Ê½£ºString fileName = "/config/abcd.config";
InputStream in = getClass().getResourceAsStream(fileName);
BufferedReader br = null;
try{
br = n ......
¹ØÓÚflex´¦Àíjava ʵÌåbean£¬ÎÒÒ²²éÁ˺öà×ÊÁÏ£¬ÏÖÔÚÖÕÓڸ㶨£¬Ð´Ò»¸ö¼òµ¥µÄÀý×Ó£¬·ÖÏí¸ø´ó¼Ò
¸ßÊ־Ͳ»Óÿ´ÁË
/*studentʵÌåÀà=java*/
public class Student implements java.io.Serializable{
private String sNo;
private String sName;
get..
set..
}
/*flex asÀà Student.as*/
packa ......