ÃæÊÔÖÐÓöµ½µÄÎÊÌ⣬´ó¼Ò¹²Í¬Ñ§Ï°£¡£¡
Java¹¤³§Ä£Ê½
Java¹¤³§Ä£Ê½¿´ÁËÕâô¶à¹ØÓÚ¹¤³§Ä£Ê½µÄ½²½â£¬»¹ÊǾõµÃÕâƪÎÄÕ½²µÄºÃÀí½â£¬Ìù³öÀ´ºÍ´ó¼Ò·ÖÏí·ÖÏí¡£
Ò»¡¢Òý×Ó
»°ËµÊ®ÄêÇ°£¬ÓÐÒ»¸ö****»§£¬Ëû¼ÒÓÐÈýÁ¾Æû³µ——Benz±¼³Û¡¢Bmw±¦Âí¡¢Audi°ÂµÏ£¬»¹¹ÍÁË˾»úΪËû¿ª³µ¡£²»¹ý£¬****»§×ø³µÊ±×ÜÊǹֵֹģºÉÏBenz³µºó¸ú˾»ú˵“¿ª±¼³Û³µ£¡”£¬×øÉÏBmwºóËû˵“¿ª±¦Âí³µ£¡”£¬×øÉÏAudi˵“¿ª°ÂµÏ³µ£¡”¡£ÄãÒ»¶¨Ëµ£ºÕâÈËÓв¡£¡Ö±½Ó˵¿ª³µ²»¾ÍÐÐÁË£¿£¡
¶øµ±°ÑÕâ¸ö****»§µÄÐÐΪ·Åµ½ÎÒÃdzÌÐòÉè¼ÆÖÐÀ´Ê±£¬»á·¢ÏÖÕâÊÇÒ»¸öÆÕ±é´æÔÚµÄÏÖÏó¡£ÐÒÔ˵ÄÊÇ£¬ÕâÖÖÓв¡µÄÏÖÏóÔÚOO£¨ÃæÏò¶ÔÏó£©ÓïÑÔÖпÉÒÔ±ÜÃâÁË¡£ÏÂÃæ¾ÍÒÔJavaÓïÑÔΪ»ù´¡À´ÒýÈëÎÒÃDZ¾ÎĵÄÖ÷Ì⣺¹¤³§Ä£Ê½¡£
¶þ¡¢·ÖÀà
¹¤³§Ä£Ê½Ö÷ÒªÊÇΪ´´½¨¶ÔÏóÌṩ¹ý¶É½Ó¿Ú£¬ÒԱ㽫´´½¨¶ÔÏóµÄ¾ßÌå¹ý³ÌÆÁ±Î¸ôÀëÆðÀ´£¬´ïµ½Ìá¸ßÁé»îÐÔµÄÄ¿µÄ¡£
¹¤³§Ä£Ê½ÔÚ¡¶JavaÓëģʽ¡·ÖзÖΪÈýÀࣺ
1£©¼òµ¥¹¤³§Ä£Ê½£¨Simple Factory£©
2£©¹¤³§·½·¨Ä£Ê½£¨Factory Method£©
3£©³éÏ󹤳§Ä£Ê½£¨Abstract Factory£©
ÕâÈýÖÖģʽ´ÓÉϵ½ÏÂÖð²½³éÏ󣬲¢ÇÒ¸ü¾ßÒ»°ãÐÔ¡£
GOFÔÚ¡¶Éè¼Æģʽ¡·Ò»ÊéÖн«¹¤³§Ä£Ê½·ÖΪÁ½Àࣺ¹¤³§ ......
È¡:
Cookie[] cookies = request.getCookies();
if(cookies!=null){
for(Cookie cookie : cookies){
if(cookie.getName().equals("mid")){
String mid = cookie.getValue();
}
}
}
´æ:
String mid = java.net.InetAddress.getLocalHost().getHostName();
Cookie c = new Cookie("mid",mid);
//ÉèÖÃcookie´æ·ÅÔÚÓ²ÅÌÉϵÄʧЧʱ¼ä,ÒÔÃëΪµ¥Î»,Èç¹û²»ÉèÖûòÉèÖÃΪ¸ºÊý,Ö»´æÔÚÓÚä¯ÀÀÆ÷»º´æ,Í˳öä¯ÀÀÆ÷´ËcookieʧЧ,²»»áдÈëÓ²ÅÌ.
//Èç¹ûÉèÖÃΪ0,Ôò»áɾ³ý´Ëcookie. ͨ¹ýfirefox cookie²é¿´Æ÷,´Ëcookie²¢Î´É¾³ý,²»ÖªÊǺÎÔÒò.ËƺõºÍÉèÖøºÊýûʲôÇø±ð.
c.setMaxAge(60*3);
//ÉèÖÃcookie´æ·ÅµÄpath,ÉèÖÃÁË´Ëpath,ÇëÇóµÄurl°üº¬´Ëpath(µ±È»ÓòÃûҲҪƥÅä)¶¼¿ÉÒԵõ½´Ëcookie.·ñÔò²»Äܵõ½.
c.setPath("/");
//ÉèÖÃcookie´æÈëµÄÓòÃû,Èç¹ûÉèÖÃΪ.test.com»òtest.com,ÔòÒÔ´ËÓòÃû½áβµÄurlÇëÇóʱ¶¼¿ÉµÃµ½´Ëcookie(µ±È»pathҲҪƥÅä),·ñÔò²»Äܵõ½.Èç¹û²»ÉèÖÃÓòÃû,ÒÔµ±Ç°ÇëÇóµÄÓòÃûΪ׼.
²»¿ÉÒÔÉèÖõ½µ±Ç°ÇëÇóµÄÓòÃûÖ®ÍâµÄÓòÃû,É ......
javaÓïÑÔµ÷ÓÃdllµÄ·½·¨£º
1¡£¼ÓÔØdll£¬±ØÐëÊǾ²Ì¬·½·¨¡£
static{
System.loadLibrary(DllConstants.DLL_PATH);
}
2¡£½«dllÖпª·¢µÄ½Ó¿ÚÉùÃ÷Ϊ±¾µØ½Ó¿Ú
public native String[] getTxt();
......
ÐÞ¸ÄJavaÎļþ²»ÓÃÖØÆôTomcat·þÎñµÄ·½·¨
ÔÚʹÓÃEclipse+Tomcat¿ª·¢JavaÏîÄ¿µÄʱºò³£³£»áÅöµ½ÕâÑùµÄÇé¿ö£¬ÒÑÐÞ¸ÄJavaÎļþTomcat¾Í»á×Ô¶¯ÖØÆô£¬½ÓÏÂÀ´¾ÍÊÇÂþ³¤µÄµÈ´ý·þÎñÖØÆôÍê±Ï¡£ÄÇÆäʵ´ó¶àÊýµÄJavaÎļþÐÞ¸ÄÊÇûÓбØÒªÖØÆô·þÎñµÄ£¬Ö»ÓÐһЩÌض¨µÄJavaÎļþ£¬±ÈÈç˵ֻÓÐÖØÆô·þÎñµÄʱºò²Å»áµ÷ÓõÄJava´úÂë²ÅÐèÒªÖØÆô·þÎñ¡£
ÐÞ¸ÄJava´úÂë²»È÷þÎñÖØÆôµÄ·½·¨ÓÐÁ½¸ö£º
1¡¢ÐÞ¸ÄTomcatµÄÅäÖÃÎļþ£¨tomcat-5.5.20\conf\Catalina\localhostĿ¼Ï£©
ÔÚÅäÖÃÖмÓÈë reloadable="false"
<Context path="/"
reloadable="false"
docBase="F:\workspace\shpm3\shpm3-web"
workDir="F:\workspace\shpm3\work" />
2¡¢Ò²¿ÉÒÔͨ¹ýEclipseÉÏÉèÖÃʵÏÖÉÏÊöÅäÖÃÎļþµÄÐÞ¸Ä
EclipseµÄ¹¤³ÌÃûÓÒ¼ü: properties->Tomcat->General->Make this context as reloadable(reloadable="true")²»ÒªÑ¡ÖÐ
EclipseµÄ¹¤³ÌÃûÓÒ¼ü:Tomcat proj ......
ÀàµÄ°ü·ÃÎÊȨÏÞ£º¡¶Java±à³Ì˼Ïë¡·ÖÐÒ»¶Î»°µÄÀ§»ó
ÔÚ¡¶java±à³Ì˼ÏëµÚÈý°æ¡·£¨³Âê»Åô ÈÄÈô骵ÈÒ룩µÄµÚÎåÕÂÒþ²Ø¾ßÌåʵÏÖÖУ¬5.4½ÚµÄ×îºóÒ»¶Î»°ÊÇ£º
“ÕýÈçÇ°ÃæËùÌáµ½µÄ£¬Èç¹ûûÄÜΪÀà·ÃÎÊȨÏÞÖ¸¶¨Ò»¸ö·ÃÎÊÐÞÊηû£¬Ëü¾Í»áȱʡµÃµ½°ü·ÃÎÊȨÏÞ¡£ÕâÒâζןÃÀàµÄ¶ÔÏó¿ÉÒÔÓÉ°üÄÚÈκÎÆäËûÀàÀ´´´½¨£¬µ«°üÍâÔòÊDz»Ðеġ££¨Ò»¶¨Òª¼Çס£¬ÏàͬĿ¼ÏµÄËùÓв»¾ßÓÐÃ÷È·packageÉùÃ÷µÄÎļþ£¬¶¼±»ÊÓ×÷ÊǸÃĿ¼ÏÂȱʡ°üµÄÒ»²¿·Ö¡££©È»¶ø£¬Èç¹û¸ÃÀàµÄij¸östatic³ÉÔ±ÊÇpublicµÄ»°£¬Ôò¿Í»§¶Ë³ÌÐòÔ±ÈԾɿÉÒÔµ÷ÓøÃstatic³ÉÔ±£¬¾¡¹ÜËûÃDz¢²»ÄÜÉú³É¸ÃÀàµÄ¶ÔÏó¡£”
¸Õ¿ªÊ¼ÎÒ¶Ô×îºóÒ»¾ä»°µÄÀí½âÊÇ£ºÈç¹ûij¸öÀàûÓÐÖ¸¶¨·ÃÎÊÐÞÊηû£¬µ«ÆäÖÐÓÐstatic³ÉÔ±ÊÇpublicµÄ»°£¬ÔÚ°üÍâµÄÀàÖÐÈÔÈ»¿ÉÒÔµ÷ÓøÃÀàµÄstaticµÄpublic·½·¨»ò·ÃÎÊstaticµÄpublic³ÉÔ±×ֶΡ£
ÓÚÊÇÎÒ×öÁËÏÂÃæµÄʵÑ飺£¨ÎÒµÄclasspathûÓÐÉèÖã¬ÊÇĬÈÏÖµ£¬¼´Êǵ±Ç°Â·¾¶£»ÎÒCMDµÄµ±Ç°Â·¾¶Thinking in java¡££©
ÔÚThinking in java\chapter5\ÏÂÓÐTest.java£¬´úÂëÈçÏÂ
package chapter5;
class Test
{
public static int i=0;
pu ......
ÔÚjava³ÌÐòÖÐ,ΪÁËʵÏÖͬ±¾µØϵͳµÄÓ²¼þ¶Ë¿Ú(RS-232±ê×¼´®¿Ú/IEEE1284±ê×¼²¢¿Ú)ͨѶ,Ä¿Ç°ÓÐÁ½¸ö·½·¨,µÚÒ»¸ö¾ÍÊÇÒÔǰ˵¹ýµÄ,ʹÓÃJNI¼¼Êõ×Ô¼ºÐ´Ò»¸öÓëjava³ÌÐòÏà¹ØµÄdll/soÎļþ,Õâ¸öÎļþ¿ÉÒÔÖ±½ÓºÍ±¾µØϵͳͨÐÅ,´Ó¶ø¹ÜÀí±¾µØ»úÆ÷µÄ¶Ë¿Ú,²»¹ýʹÓÃjava³ÌÐò¶À×ÔʵÏÖÒ»¸ö±È½ÏÍêÉƵĶ˿ڹÜÀí½â¾ö·½°¸¶Ô¸öÈ˶øÑÔÊÇÒ»¸ö»¨·Ñ¾Þ´óÇÒ²»Êµ¼ÊµÄÏë·¨.µÚ¶þ¸ö·½·¨¾ÍÊÇʹÓÃsun¹«Ë¾ÌṩµÄcomm°ü,ÕâÌ×APIÊÇÓÃÓÚ¿ª·¢Æ½Ì¨¶ÀÁ¢µÄͨѶӦÓóÌÐòµÄÀ©Õ¹API,µ«ÊÇÕâ¸ö°ü²¢Î´°üº¬ÔÚsunµÄj2se°üÖÐ,¶øÊÇÒÔ¶ÀÁ¢jar°üÐÎʽ·¢²¼ÔÚjava.sun.comÍøÕ¾ÉÏ,ÏÂÃæ½öÌÖÂÛʹÓÃcomm°ü¹ÜÀí±¾µØ»úÆ÷¶Ë¿ÚµÄ·½·¨.
comm°üÄ¿Ç°ÓÐÈýÖÖϵͳµÄ°æ±¾,·Ö±ðÊÊÓÃÓÚx86ºÍSparc½á¹¹ÏµÄSolarisϵͳ,ÒÔ¼°x86ϵÄLinuxϵͳ,x86ϵÄwindowsϵͳ,µ«ÊÇÔÚsunµÄÍøÕ¾ÉÏÃæ,½öÌṩÁËWindowsºÍSolarisƽ̨ϵÄÁ½¸ö°æ±¾,Èç¹ûÐèÒªlinuxϵÄcomm°ü,ÐèÒª´ÓµÚÈý·½ÍøÕ¾ÏÂÔØ,¾Ý˵Õâ¸öµØÖ·http://www.geeksville.com/~kevinh/linuxcomm.html¿ÉÒÔÏÂÔØ(µ«ÊÇÎÒ·ÑÁ˺ܳ¤Ê±¼ä²¢Ã»ÓдÓÕâÀïÏÂÔØÏÂÀ´,¶øÊÇ´ÓCSDNÏÂÔØÖÐÐÄÕÒµ½µÄ).
ÊÊÓÃÓÚ²»Í¬ÏµÍ³Æ½Ì¨ÏµÄcomm.jar°üº¬µÄ±¾µØ½Ó¿ÚÎļþÊDz»Ò»Ñ ......
×ܼǼÊý:6386; ×ÜÒ³Êý:1065; ÿҳ6 Ìõ;
Ê×Ò³ ÉÏÒ»Ò³ [7] [8] [9] [10] 11
[12] [13] [14] [15] [16] ÏÂÒ»Ò³ βҳ