[ת]Java »ñÈ¡µ±Ç°Â·¾¶&System.getProperty()²ÎÊý´óÈ«
1¡¢ÀûÓÃSystem.getProperty()º¯Êý»ñÈ¡µ±Ç°Â·¾¶£º
System.out.println(System.getProperty("user.dir"));//user.dirÖ¸¶¨Á˵±Ç°µÄ·¾¶
2¡¢Ê¹ÓÃFileÌṩµÄº¯Êý»ñÈ¡µ±Ç°Â·¾¶£º
File directory = new File("");//É趨Ϊµ±Ç°Îļþ¼Ð
try{
System.out.println(directory.getCanonicalPath());//»ñÈ¡±ê×¼µÄ·¾¶
System.out.println(directory.getAbsolutePath());//»ñÈ¡¾ø¶Ô·¾¶
}catch(Exceptin e){}
File.getCanonicalPath()ºÍFile.getAbsolutePath()´óÔ¼Ö»ÊǶÔÓÚnew File(".")ºÍnew File("..")Á½ÖÖ·¾¶ÓÐËùÇø±ð¡£
# ¶ÔÓÚgetCanonicalPath()º¯Êý£¬¡°."¾Í±íʾµ±Ç°µÄÎļþ¼Ð£¬¶ø¡±..¡°Ôò±íʾµ±Ç°Îļþ¼ÐµÄÉÏÒ»¼¶Îļþ¼Ð
# ¶ÔÓÚgetAbsolutePath()º¯Êý£¬Ôò²»¹Ü¡±.¡±¡¢¡°..¡±£¬·µ»Øµ±Ç°µÄ·¾¶¼ÓÉÏÄãÔÚnew File()ʱÉ趨µÄ·¾¶
# ÖÁÓÚgetPath()º¯Êý£¬µÃµ½µÄÖ»ÊÇÄãÔÚnew File()ʱÉ趨µÄ·¾¶
±ÈÈ統ǰµÄ·¾¶Îª C:\test £º
File directory = new File("abc");
directory.getCanonicalPath(); //µÃµ½µÄÊÇC:\test\abc
directory.getAbsolutePath(); //µÃµ½µÄÊÇC:\test\abc
direcotry.getPath(); //µÃµ½µÄÊÇabc
File directory = new File(".");
directory.getCanonicalPath(); //µÃµ½µÄÊÇC:\test
directory.getAbsolutePath(); //µÃµ½µÄÊÇC:\test\.
direcotry.getPath(); //µÃµ½µÄÊÇ.
File directory = new File("..");
directory.getCanonicalPath(); //µÃµ½µÄÊÇC:\
directory.getAbsolutePath(); //µÃµ½µÄÊÇC:\test\..
direcotry.getPath(); //µÃµ½µÄÊÇ..
ÁíÍ⣺System.getProperty()ÖеÄ×Ö·û´®²ÎÊýÈçÏ£º
System.getProperty()²ÎÊý´óÈ«
# java.version
Ïà¹ØÎĵµ£º
Javaѧϰ´ÓÈëÃŵ½¾«Í¨
Ò»¡¢ JDK (Java Development Kit)
JDKÊÇÕû¸öJavaµÄºËÐÄ£¬°üÀ¨ÁËJavaÔËÐл·¾³£¨Java Runtime Envirnment£©£¬Ò»¶ÑJava¹¤¾ßºÍJava»ù´¡µÄÀà¿â(rt.jar)¡£²»ÂÛʲôJavaÓ¦Ó÷þÎñÆ÷ʵÖʶ¼ÊÇÄÚÖÃÁËij¸ö°æ±¾µÄJDK¡£Òò´ËÕÆÎÕJDKÊÇѧºÃJavaµÄµÚÒ»²½¡£×îÖ÷Á÷µÄJ ......
½â¾öÕ»ºÍ¶ÑÄÚ´æÒç³ö°ì·¨ÒªÉèÖû·¾³ÄÚ´æ±äÁ¿£º
1¡¢ÔÚÔËÐнçÃ棨cmd½øÈ룩ÖÐÔËÐÐÃüÁjava -Xms256m -Xmx1024m£¬Î¬»¤ÉÏÏÂÏÞÄÚ´æ²ÎÊý£¬×î´óÄÚ´æ²»ÄÜ´í¹ýϵͳÄÚ´æµÄ1/4£¬×îСÄÚ´æ²»ÄÜСÓÚ×î´óÄÚ´æµÄ1/4
2¡¢ÔÚTommcat /bin·¾¶Ï£¬Èç¹ûÊÇ°²×°°æÐèÒªservice.batÎļþ,´ËÎļþÔÚ½âѹËõ°æÀï¡£
3¡¢ ÔÚÔËÐнçÃ棨cmd½øÈ룩ÖÐ
......
Vector : »ùÓÚArrayµÄList£¬Æäʵ¾ÍÊÇ·â×°ÁËArrayËù²»¾ß±¸µÄһЩ¹¦ÄÜ·½±ãÎÒÃÇʹÓã¬Ëü²»¿ÉÄÜ×ßÈëArrayµÄÏÞÖÆ¡£ÐÔÄÜÒ²¾Í²»¿ÉÄÜ
³¬Ô½Array¡£ËùÒÔ£¬ÔÚ¿ÉÄܵÄÇé¿öÏ£¬ÎÒÃÇÒª¶àÔËÓÃArray¡£ÁíÍâºÜÖØÒªµÄÒ»µã¾ÍÊÇVector“sychronized”µÄ£¬Õâ¸öÒ²ÊÇVectorºÍ
ArrayListµÄΨһµÄÇø±ð¡£
ArrayList£ºÍ¬VectorÒ»ÑùÊÇÒ»¸ö»ùÓ ......
Ò»£ºÀí½â¶àÏß³Ì
¶àÏß³ÌÊÇÕâÑùÒ»ÖÖ»úÖÆ£¬ËüÔÊÐíÔÚ³ÌÐòÖв¢·¢Ö´Ðжà¸öÖ¸ÁîÁ÷£¬Ã¿¸öÖ¸ÁîÁ÷¶¼³ÆΪһ¸öỊ̈߳¬±Ë´Ë¼ä»¥Ïà¶ÀÁ¢¡£
Ïß³ÌÓÖ³ÆΪÇáÁ¿¼¶½ø³Ì£¬ËüºÍ½ø³ÌÒ»ÑùÓµÓжÀÁ¢µÄÖ´ÐпØÖÆ£¬ÓɲÙ×÷ϵͳ¸ºÔðµ÷¶È£¬Çø±ðÔÚÓÚÏß³ÌûÓжÀÁ¢µÄ´æ´¢¿Õ¼ä£¬¶øÊǺÍËùÊô½ø³ÌÖеÄÆäËüÏ̹߳²ÏíÒ»¸ö´æ´¢¿Õ¼ä£¬ÕâʹµÃÏ̼߳äµÄͨÐÅÔ¶½Ï½ø³Ì¼òµ¥¡£
......
Calendar ÀàÊÇÒ»¸ö³éÏóÀ࣬ËüΪÌض¨Ë²¼äÓëÒ»×éÖîÈç YEAR¡¢MONTH¡¢DAY_OF_MONTH¡¢HOUR µÈ ÈÕÀú×Ö¶ÎÖ®¼äµÄת»»ÌṩÁËһЩ·½·¨£¬²¢Îª²Ù×÷ÈÕÀú×ֶΣ¨ÀýÈç»ñµÃÏÂÐÇÆÚµÄÈÕÆÚ£©ÌṩÁËһЩ·½·¨¡£Ë²¼ä¿ÉÓúÁÃëÖµÀ´±íʾ£¬ËüÊǾàÀúÔª£¨¼´¸ñÁÖÍþÖαê׼ʱ¼ä 1970 Äê 1 Ô 1 ÈÕµÄ 00:00:00.000£¬¸ñÀï¸ßÀûÀú£©µÄÆ«ÒÆÁ¿¡£
Àý:
Calenda ......