ÔÚLinuxƽ̨ÏÂʹÓÃJNI
±¾ÎļòÒª½éÉÜÁËJNIµ÷Óù淶£¬¼°³£Óú¯Êý¡£²¢Í¨¹ý¾ßÌåʾÀý³ÌÐòչʾÁËʵÏÖÒ»¸ö±¾µØµ÷ÓõĻù±¾²½Öè¡£
ÒýÑÔ
Java
µÄ³öÏÖ¸ø´ó¼Ò¿ª·¢´øÀ´µÄ¼«´óµÄ·½±ã¡£µ«ÊÇ£¬Èç¹ûÎÒÃÇÓдóÁ¿ÔÓеľ¹ý¹ã·º²âÊԵķÇJava´úÂ룬½«ËüÃÇÈ«²¿ÓÃJavaÀ´ÖØд£¬¿ÖÅ»á´øÀ´¾Þ´óµÄ¹¤×÷Á¿ºÍ³¤
ÆڵIJâÊÔ£»Èç¹ûÎÒÃǵÄÓ¦ÓÃÖÐÐèÒª·ÃÎʵ½Ìض¨µÄÉ豸£¬ÉõÖÁÊǽö·ûºÏ¹«Ë¾ÄÚ²¿ÐÅÏ¢½»»¥¹æ·¶µÄÉ豸£¬»òij¸öÌض¨µÄ²Ù×÷ϵͳ²ÅÓеÄÌØÐÔ£¬Java¾ÍÏÔµÃÓÐЩÁ¦²»´Ó
ÐÄÁË¡£Ãæ¶ÔÕâЩÎÊÌ⣬Sun¹«Ë¾ÔÚJDK1.0ÖоͶ¨ÒåÁËJNI¹æ·¶£¬Ëü¹æ¶¨ÁËJavaÓ¦ÓóÌÐò¶Ô±¾µØ·½·¨µÄµ÷ÓùæÔò¡£
ʵÏÖ²½Öè¼°Ïà¹Øº¯ÊýʹÓÃ
±¾ÎĽ«Ò»²½²½ËµÃ÷ÔÚLinuxƽ̨ÏÂÈçºÎʵÏÖ±¾µØ¹²Ïí¿âÓëJavaÐͬ¹¤×÷¡£Hello World³ÌÐòÊÇÄ¿Ç°±ê×¼µÄÈëÃŵÚÒ»²½£¬ÄÇô£¬ÎÒÒ²ÒÔÀàËƵÄÓ¦ÓÃ×îΪÑùÀý¡£
µÚÒ»²½£¬¶¨ÒåÒ»¸ö Java Àà -- Hello. ËüÌṩSayHello·½·¨£º
´ËʱӦעÒâÁ½µã£º
1.ΪҪʹÓõÄÿ¸ö±¾µØ·½·¨±àд±¾µØ·½·¨ÉùÃ÷£¬ÆäÉùÃ÷·½Ê½ÓëÆÕͨ Java ·½·¨½Ó¿Úûʲô²»Í¬£¬Ö»ÊDZØÐëÖ¸¶¨ native ¹Ø¼ü×Ö£¬ÈçÏÂËùʾ£º
public native void SayHello(String strName);
ÔÚÕâ¸öº¯ÊýÖУ¬ÎÒÃǽ«¸ù¾Ý´«½øµÄÈËÃû£¬ÏòijÈËÎʺá£
2.±ØÐëÏÔʽµØ¼ÓÔر¾µØ´úÂë¿â¡£ÎÒÃÇÐèÔÚÀàµÄÒ»¸ö¾²Ì¬¿éÖмÓÔØÕâ¸ö¿â£º
static
{
System.loadLibrary("hello");
}
ÔÙ¼ÓÉϱØÒªµÄÒì³£´¦Àí¾ÍÉú³ÉÈçÏÂÔ´ÎļþHello.java£º
public class Hello
{
static
{
try
{
//´Ë´¦¼´Îª±¾µØ·½·¨ËùÔÚÁ´½Ó¿âÃû
System.loadLibrary("hello");
}
catch(UnsatisfiedLinkError e)
{
System.err.println( "Cannot load hello library:\n " +
e.toString() );
}
}
public Hello()
{
}
//ÉùÃ÷µÄ±¾µØ·½·¨
public native void SayHello(String strName);
}
±àÒëºóÉú³ÉHello.classÎļþ¡£
µÚ¶þ²½£¬Éú³É±¾µØÁ´½Ó¿â¡£¾ßÌå¹ý³ÌÈçÏ£º
1.
ҪΪÒÔÉ϶¨ÒåµÄÀàÉú³É Java ±¾µØ½Ó¿ÚÍ·Îļþ£¬ÐèʹÓÃjavah£¬Java ±àÒëÆ÷µÄ javah ¹¦Äܽ«¸ù¾Ý
HelloÀàÉú³É±ØÒªµÄÉùÃ÷£¬´ËÃüÁÉú³ÉHello.h
Îļþ£¬ÎÒÃÇÔÚ¹²Ïí¿âµÄ´úÂëÖÐÒª°üº¬Ëü£¬javah²»Ê¹Ä¬ÈÏÄÚ²¿ÃüÁÐèÒªÖ¸Ã÷·¾¶£¬ËüÔÚJDKµÄbinĿ¼Ï£¬ÔÚÎÒµÄLinux»·¾³ÏÂÃüÁîÈçÏ£º
/home/jbuilder/jdk1.3.1/bin/javah Hello
Éú³ÉµÄHello.h Îļþ ÄÚÈÝÈçÏÂËùʾ£º
/* DO NOT EDIT THIS FILE - it
Ïà¹ØÎĵµ£º
http://shake863.javaeye.com/blog/181246
top
top
ÃüÁîÊÇ×îÁ÷ÐеÄÐÔÄܹ¤¾ßÖ®Ò»¡£´ó¶àÊýϵͳ¹ÜÀíÔ±ÔËÐÐtop
²é¿´Linux
ºÍUNIXϵͳµÄÔËÐÐÇé¿ö¡£top
ʵÓù¤¾ßÌṩһÖÖ¼àÊÓ½ø³ÌºÍLinux
ÕûÌåÐÔÄܵÄÀíÏë·½·¨¡£½«Linux
½ø³Ì³Æ×÷ÈÎÎñ¸ü׼ȷ£¬µ«ÊÇÔÚ±¾ÕÂÖÐÎÒÃÇ»¹Êǽ«ËüÃdzÆ×÷½ø³Ì£¬ÒòΪÕâ¸ö¹¤¾ßÒ²ÕâÑù³ÆºôËüÃÇ¡£1
ÆÕͨÓû§º ......
±¾ÎÄ´Ó¸÷·½Ãæ²ûÊöÁËRed Hat LinuxµÄ°²È«ÅäÖ÷½·¨£¬Èç¹ûÄúʹÓõÄÊÇWindows Server 2003·þÎñÆ÷µÄ»°£¬Çë¿´Windows Server 2003 ϵͳÅäÖ÷½°¸¡£
ÍøÂ簲ȫÊÇÖ¸ÍøÂçϵͳµÄÓ²¼þ¡¢Èí¼þ¼°ÆäϵͳÖеÄÊý¾ÝÊܵ½±£»¤£¬²»ÊÜżȻµÄ»òÕ߶ñÒâµÄÔÒò¶øÔâµ½ÆÆ»µ¡¢¸ü¸Ä¡¢Ð¹Â¶£¬ÏµÍ³Á¬Ðø¿É¿¿Õý³£µØÔËÐУ¬ÍøÂç·þÎñ²»Öжϡ£
ÍøÂ簲ȫ´ÓÆä±¾ÖÊÉÏÀ´ ......
3¡¢PHP°²×°
1£©»¹ÊÇÏÂÔØÔ´Âë°ü£¬È磺php-5.1.1.tar.gz£¬ÏÂÔصØÖ·£ºhttp://www.php.net
2£©½âѹËõ£¬>tar -zxvf php-5.1.1.tar.gz
3£©½øÈëphp-5.1.1£¬>cd php-5.1.1
4£©°²×°ÅäÖã¬>./configure --prefix=/opt/php
--with-apxs2=/opt/apache/bin/apxs --with-mysql=/opt/mysql
--with-mysqli=/opt/mysql/bin/ ......
MEMCACHED°²×°
Ò»¡¢·þÎñ¶Ë¡£ÏÈ°²×°libevent£¬ÔÙ°²×°memcached¡££¨×¢£ºlibeventÊÇÒ»Ì׿çƽ̨µÄʼþ´¦Àí½Ó¿ÚµÄ·â×°£¬Äܹ»¼æÈÝ°üÀ¨£ºWindows/Linux/BSD/SolarisµÈ²Ù×÷ϵͳµÄʼþ´¦Àí£©
1¡¢ÏÂÔØ×îа汾µÄlibeventºÍmemcached£¬±ÊÕߵݲװĿ¼Ϊ/soft
>cd /soft
>wget http://www.dange.com/memcached/dist/memcach ......
Ò»¡£linuxϵͳµÄĬÈϱàÂëÉèÖá£
/etc/sysconfig/i18n
Controls the system font
settings. The language variables are used in /etc/profile.d/lang.sh. An
example i18n file:
LANG="zh_CN.GB18030"
LANGUAGE="zh_CN.GB18030:zh_CN.GB2312:zh_CN"
SUPPORTED="zh_CN.GB18030:zh_CN ......