Javaµ÷ÓÃC/C++ – JNI
×òÌì²Å¿´µ½£¬µ«ÊÇÓöµ½Ò»Ð©ÎÊÌ⣬½ñÌì½â¾öÁË£¬¼ÇÏ¡¡£¨²Î¿¼£ºhttp://netbeans.org/kb/55/beginning-jni-part1.html£©
ÎÒÓõÄÊÇNetbeans 6.7£¬µ«ÊǺÍÆäËûµÄÒ²Ó¦¸Ã´óͬСÒì°É¡£ »ù±¾Á÷³Ì£º JavaÕâ±ßµÄ£º
´´½¨javaÎļþ£¨´ønativeµÄ£©£¬»¹Òª¼ÇµÃÔÚÀàÖмÓÈ룺System.loadLibrary(xxx) ¡£
È»ºóÓÃjavahÀ´Éú³ÉC/C++µÄÍ·Îļþ£¨±ÈÈ磺javah –o pzc.h –jni –classpath ¡ pzjava.Main£©¡£ CÕâ±ßµÄ£º
×öÒ»¸ö¡°Öмä²ã¡±µÄC»òÕßC++Îļþ£¬include¸Õ²ÅÉú³ÉµÄÍ·Îļþ£¬°Ñ·½·¨¸´ÖÆÏÂÀ´¡£
»¹Òª¼ÇµÃ°Ñ%JAVA_HOME%\include\ºÍ%JAVA_HOME%\include\win32Ìí¼Óµ½±àÒëÆ÷µÄÍ·ÎļþËÑË÷·¾¶ÖУ¨»¹ÒªÌí¼ÓÉϸոÕÉú³ÉµÄÍ·ÎļþµÄËÑË÷·¾¶£© ¡£
ҪעÒâÉèÖúñàÒëÆ÷Êä³öµÄ¶¯Ì¬¿âÎļþÃû£¬ÒªºÍloadLibraryÖеÄÒ»Ö£¨ÔÚWindowsÏÂÈç¹ûxxxÊÇ"pzc¡±£¬ÄÇÊä³öµÄ¾ÍÊÇpzc.dll£¬Èç¹ûÊÇlinux£¬¾ÍÊÇlibpzc.so£©¡£
»¹Òª×¢ÒâÉèÖñàÒëÆ÷µÄÆäËû²ÎÊý£¬È磺--add-stdcall-alias£¨ÔÚWindowsÏÂÐèÒª£©£¨²é¿´gccÊÖ²á¾ÍÖªµÀËüµÄÒâ˼£©¡£
±àÒëºÃdllºó°Ñdll¸´ÖƵ½javaÏîÄ¿¿Õ¼ä¾ÍÐÐÁË¡£ ÓÐʱgccÑ¡ÏҪ¼Ó-m32£¬°´ÕÕÔÎÄËù˵µÄ£¬Òâ˼Ӧ¸ÃÊÇ£¬Èç¹ûÊÇÔÚ64λµÄ»úÆ÷ÉÏÏëÒª°Ñdll±àÒë³É32λµÄ»°£¬ÄǾÍÒª¼ÓÉÏÕâ¸öÑ¡Ïî¡£
Ïà¹ØÎĵµ£º
javaÖеÄʼþ»úÖƵIJÎÓëÕßÓÐ3ÖÖ½ÇÉ«£º
1.event object£º¾ÍÊÇʼþ²úÉúʱ¾ßÌåµÄ“ʼþ”£¬ÓÃÓÚlistenerµÄÏàÓ¦µÄ·½·¨Ö®ÖУ¬×÷Ϊ²ÎÊý£¬Ò»°ã´æÔÚÓëlisternerµÄ·½·¨Ö®ÖÐ
2.event source£º¾ßÌåµÄ½ÓÊÜʼþµÄʵÌ壬±ÈÈç˵£¬Äãµã»÷Ò»¸öbutton£¬ÄÇôbutton¾ÍÊÇevent source£¬ÕâÑùÄã±ØÐëʹbutton¶ÔijЩʼþ½øÐÐÏàÓ¦£¬Äã¾ÍÐè ......
ÎÊÌâÃèÊö
Exception in thread "main" java.lang.OutOfMemoryError:
Java heap space
½â¾ö·½°¸[ת]
Ò»Ö±¶¼ÖªµÀ¿ÉÒÔÉèÖÃjvm heap´óС£¬Ò»Ö±ÓÃeclipseд/µ÷ÊÔjava³ÌÐò¡£Ò»Ö±ÓÃÃüÁîÐÐor
console¼Ó²ÎÊýÅܳÌÐò¡£ÏÖÏó£ºÔÚeclipseµÄÅäÖÃÎļþeclipse.iniÖÐÉèÖÃ-vmargs -Xms500m
-Xmx1024m
£¬ÔÚeclipseÖ ......
Java ¶àÏ̱߳à³ÌÖ®Èý£ºsynchronized ¹Ø¼ü×ÖµÄʹÓÃ
´øÓÐ synchronized ¹Ø¼ü×ֵķ½·¨´ú±íÕâ¸ö·½·¨¼ÓËø¡£Ç¡µ±¶øÓÖÁé»îµØÔËÓà synchronized ¹Ø¼ü×Ö£¬ÊǶàÏ̱߳à³ÌµÄ±ØÐ޿Ρ£
¡¡¡¡1¡¢synchronized¹Ø¼ü×ÖµÄ×÷ÓÃÓòÓжþÖÖ£º
¡¡¡¡1£©ÊÇij¸ö¶ÔÏóʵÀýÄÚ£¬synchronized aMethod(){}¿ÉÒÔ·ÀÖ¹¶à ......
package cn.ctgu.edu.ac;
import java.sql.*;
public class test {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String url="jdbc:sqlserver://localhost:1433;Database=ÍøÉÏÊéµê¹ÜÀíϵͳ;integr ......