javaÐéÄâ»úʹÓÃÄÚ´æµÄ˼¿¼
¹ØÓÚjavaÐéÄâ»úʹÓÃÄÚ´æµÄ˼¿¼
JVM(javaÐéÄâ»ú)Æäʵ¾ÍÊDzÙ×÷ϵͳ(Èçwindows)ÉϵÄÒ»¸öÆÕͨ³ÌÐò(½ø³ÌÃû½Ðjava,Õâ¸ö³ÌÐò¿ÉÒÔ½âÊÍÖ´ÐÐclassÎļþ)¡£
µ±java½ø³ÌÆô¶¯Ê±»áÊ×ÏÈ·ÖÅäÒ»¿é¶ÑÄڴ棨×îСÄڴ棩£¬ÒÔºóÿµ±class×Ö½ÚÂë³ÌÐòÒªÇóJVM(java½ø³Ì)·ÖÅäÄÚ´æʱ£¬JVM
¾Í»áÔÚÔ¤ÏÈ·ÖÅäµÄÄÇ¿éÄÚ´æÉÏÃæΪclass×Ö½ÚÂë³ÌÐò·ÖÅäÄڴ棬µ±Ô¤ÏÈ·ÖÅäµÄÄÇ¿éÄÚ´æÓÃûʱ£¬JVM»áÔÙÏò²Ù×÷ϵͳҪÄÚ´æ
£¨ÎïÀíÄڴ棩£¬ µ«ÊÇJVM²»»áÎÞÏÞÖƵÄÏò²Ù×÷ϵͳҪÄڴ棬µ±ËüÕ¼ÓõÄʵ¼Ê¶ÑÄÚ´æ´ïµ½Ò»¸öÔ¤¶¨Öµ£¨×î´ó¿ÉÓÃÄڴ棩ʱ£¬
Èç¹ûclass×Ö½ÚÂë³ÌÐò»¹ÏòJVMÒªÄڴ棬²¢ÇÒJVMÎÞ·¨Í¨¹ý»ØÊÕµ±Ç°¶ÑÖеÄÄÚ´æÀ´Îªclass×Ö½ÚÂë³ÌÐò·þÎñʱ£¬Ëü¾Í»á¸ø³Ì
ÐòÅ׳öjava.lang.OutOfMemoryError¡£ÆäÖÐÄÚ´æ»ØÊÕʱ»ú²¢²»ÊÇÔÙÓõôÄÚ´æ´ïµ½×î´ó¿ÉÓÃÄÚ´æʱ²Å½øÐУ¬ËûµÄÔËÐÐʱ»úÊÇ
²»È·¶¨µÄ£¬¿É¼ûJVMµÄ×î´ó¿ÉÓÃÄÚ´æ¾ÍÊÇÄãµÄjava³ÌÐò£¨class×Ö½ÚÂë³ÌÐò£©Äܹ»Ê¹ÓõÄ×î´óÄÚ´æ¡£
ÀýÈ磺Äã°Ñjvm×î´ó¿ÉÓÃÄÚ´æÉèΪ200M,¶øÄãµÄÎïÀíÄÚ´æ1G.ÔÚÕâÖÖ³ÌÐòÏÂÄãµÄclass³ÌÐò×î¶àÄÜʹÓÃ200MÄڴ棬ËäÈ»Äã¿ÉÄÜ
»¹ÓÐ800MÄÚ´æ¿ÉÓ㬵«Êǵ±ÄãµÄ³ÌÐòÓõô200MºóÈç¹ûÔÙÒªÄڴ棬JVM²»»áÒòΪÄ㻹ÓÐ800MÄÚ´æ¶øΪÄã·ÖÅäÄڴ棬Ëû»áÏòÄãÅ×
³öjava.lang.OutOfMemoryError .
ËùÒÔJVM×î´ó¿ÉÓÃÄÚ´æ²ÎÊý±È½ÏÖØÒª¡£
Ò»°ã½¨Òé¶ÑµÄ×î´óÖµÉèÖÃΪ¿ÉÓÃÄÚ´æµÄ×î´óÖµµÄ80%¡£
£¨ÒÔÏÂΪתÍøÂ磩
TomcatĬÈÏ¿ÉÒÔʹÓõÄÄÚ´æΪ64MB£¬ÔڽϴóÐ͵ÄÓ¦ÓÃÏîÄ¿ÖУ¬ÕâµãÄÚ´æÊDz»¹»µÄ£¬ÐèÒªµ÷´ó¡£
WindowsÏ£¬ÔÚÎļþ{tomcat_home}/bin/catalina.bat£¬UnixÏ£¬ÔÚÎļþ{tomcat_home}/bin/catalina.shµÄÇ°Ã棬
Ôö¼ÓÈçÏÂÉèÖãº
set JAVA_OPTS=-Xms¡¾³õʼ»¯ÄÚ´æ´óС¡¿ -Xmx¡¾¿ÉÒÔʹÓõÄ×î´óÄÚ´æ¡¿
ÐèÒª°ÑÕâ¸öÁ½¸ö²ÎÊýÖµµ÷´ó¡£ÀýÈ磺 set JAVA_OPTS=-Xms64m -Xmx256m
±íʾ³õʼ»¯ÄÚ´æΪ256MB£¬¿ÉÒÔʹÓõÄ×î´óÄÚ´æΪ512MB¡£
ÁíÍâÐèÒª¿¼ÂǵÄÊÇJavaÌṩµÄÀ¬»ø»ØÊÕ»úÖÆ¡£ÐéÄâ»úµÄ¶Ñ´óС¾ö¶¨ÁËÐéÄâ»ú»¨·ÑÔÚÊÕ¼¯À¬»øÉϵÄʱ¼äºÍƵ¶È¡£ÊÕ¼¯À¬»ø¿É
ÒÔ½ÓÊܵÄËÙ¶ÈÓëÓ¦ÓÃÓйأ¬Ó¦¸Ãͨ¹ý·ÖÎöʵ¼ÊµÄÀ¬»øÊÕ¼¯µÄʱ¼äºÍƵÂÊÀ´µ÷Õû¡£Èç¹û¶ÑµÄ´óСºÜ´ó£¬ÄÇôÍêÈ«À¬»øÊÕ¼¯¾Í
»áºÜÂý£¬µ«ÊÇƵ¶È»á½µµÍ¡£Èç¹ûÄã°Ñ¶ÑµÄ´óСºÍÄÚ´æµÄÐèÒªÒ»Ö£¬ÍêÈ«ÊÕ¼¯¾ÍºÜ¿ì£¬µ«ÊÇ»á¸ü¼ÓƵ·±¡£µ÷Õû¶Ñ´óСµÄµÄÄ¿
µÄÊÇ×îÐ
Ïà¹ØÎĵµ£º
´úÂë¿é£º¾ÍÊÇÓÃ{}À¨ÆðÀ´µ½²¿·Ö¡£¸ù¾ÝÓ¦ÓõIJ»Í¬·ÖΪ4Àà:ÆÕͨ´úÂë¿é¡¢¹¹Ôì¿é¡¢¾²Ì¬´úÂë¿é¡¢Í¬²½´úÂë¿é¡£
1.ÆÕͨ´úÂë¿é£º¶¨ÒåÔÚ·½·¨ÖеĴúÂë¿é¡£
È磺
public class Ex22 {
public static void main(String[] args){
// ÆÕͨ´úÂë¿é
{
int i = 3;
System.out.println("¾Ö²¿±äÁ¿Îª " + i);
}
int i = 5 ......
FLEX:
[Bindable] public var ary1:Array=[];
private function init():void{
ary1.push('»ÆÏþ»ª');
......
Ìâ¼Æ£ºÕâÀï¸ø³öjava½âÎöxml£¬ÒÔ°ïÖúÈËÃÇÀí½âÐí¶àÈÝÆ÷ÊÇÔõô×öµÄ¡£¡£Ïñspring£¬strutsµÈ.
1.mysql.xml´úÂ룺
<?xml version="1.0" encoding="UTF-8"?>
<data>
<datasource>
<servername>localhost</servername>
<serverport>3306</serverport>
<databasen ......
ÓÐÁ½ÖÖ·½Ê½£º¾²Ì¬²¿ÊðºÍ¶¯Ì¬²¿Êð¡£ÔÚÏÂÎÄÖÐ$CATALINA_HOMEÖ¸µÄÊÇTomcat¸ùĿ¼¡£
Ò»¡¢¾²Ì¬²¿Êð
¾²Ì¬²¿ÊðÖ¸µÄÊÇÎÒÃÇÔÚ·þÎñÆ÷Æô¶¯Ö®Ç°²¿Êð³ÌÐò£¬Ö»Óе±·þÎñÆ÷Æô¶¯Ö®ºó£¬WebÓ¦ÓóÌÐò²ÅÄÜ·ÃÎÊ¡£ÒÔÏÂ3Öз½Ê½¶¼¿ÉÒÔ²¿Êð£º
1¡¢½«PetWebĿ¼¿½±´µ½$CATALINA_HOME\webappsÏ£¬È»ºóÆô¶¯·þÎñÆ÷¾Í¿ÉÒÔÁË¡£ÕâÖÖ·½Ê½±È½Ï¼òµ¥£¬µ«ÊÇweb ......
ÔÚ»ñÈ¡Îı¾µÄʱºò£¬¾³£Óöµ½Êý¾Ý¸ñʽµÄÎÊÌ⣬ÐèÒªÅжϻòת»»¡£
±¾ÎÄÖ¼ÔÚ½â¾öÈ«½Ç·ûºÅת»»Îª°ë½Ç·ûºÅµÄÎÊÌâ¡£
ÍøÉÏ´óÌåÓÐÁ½ÖÖ·½·¨£º×ª»»±àÂë»òÔòÌæ»»¡£
ÎÒʹÓõÄÊÇת»»±àÂë
1. string checkStr="£±£²£³456";
2. //ÅжÏÊÇ·ñ°üº¬È«½Ç×Ö·û[1]
3. if(checkStr.length() != checkStr.getBytes().length) ......