Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Java·¾¶ÎÊÌâ×îÖÕ½â¾ö·½°¸

Ç°ÑÔ
¡¡¡¡JavaµÄ·¾¶ÎÊÌ⣬·Ç³£ÄѸ㡣×î½üµÄ¹¤×÷Éæ¼°µ½´´½¨ºÍ¶ÁÈ¡ÎļþµÄ¹¤×÷£¬ÕâÀïÎҾ͸ø´ó¼Ò³¹µ×µÃ½â¾öJava·¾¶ÎÊÌâ¡£
¡¡
¡¡ÎÒ±àдÁËÒ»¸ö·½·¨£¬±ÈClassLoader.getResource(String
Ïà¶Ô·¾¶)·½·¨µÄÄÜÁ¦¸üÇ¿¡£Ëü¿ÉÒÔ½ÓÊÜ"../"ÕâÑùµÄ²ÎÊý£¬´ðÓ¦ÎÒÃÇÓÃÏà¶Ô·¾¶À´¶¨Î»classpathÍâÃæµÄ×ÊÔ´¡£ÕâÑù£¬ÎÒÃǾͿÉÒÔʹÓÃÏà¶ÔÓÚ
classpathµÄ·¾¶£¬¶¨Î»ËùÓÐλÖõÄ×ÊÔ´£¡
¡¡¡¡Java·¾¶
¡¡¡¡JavaÖÐʹÓõÄ·¾¶£¬·ÖΪÁ½ÖÖ£º¾ø¶Ô·¾¶ºÍÏà¶Ô·¾¶¡£¾ßÌå¶øÑÔ£¬ÓÖ·ÖΪËÄÖÖ£º
¡¡¡¡Ò»¡¢URIÐÎʽµÄ¾ø¶Ô×ÊԴ·¾¶
¡¡¡¡È磺file:/D:/java/eclipse32/workspace/jbpmtest3/bin/aaa.b
¡¡¡¡URLÊÇURIµÄÌØÀý¡£URLµÄǰ׺/ЭÒ飬±ØÐëÊÇJavaÊìϤµÄ¡£URL¿ÉÒÔ´ò¿ª×ÊÔ´£¬¶øURIÔò²»ÐС£
¡¡¡¡URLºÍURI¶ÔÏó¿ÉÒÔ»¥Ïàת»»£¬Ê¹Óø÷×ÔµÄtoURI(),toURL()·½·¨¼´¿É£¡
¡¡¡¡¶þ¡¢±¾µØϵͳµÄ¾ø¶Ô·¾¶
¡¡¡¡D:/java/eclipse32/workspace/jbpmtest3/bin/aaa.b
¡¡¡¡Java.io°üÖеÄÀ࣬ÐèҪʹÓÃÕâÖÖÐÎʽµÄ²ÎÊý¡£
¡¡¡¡µ«ÊÇ£¬ËüÃÇÒ»°ãÒ²ÌṩÁËURIÀàÐ͵IJÎÊý£¬¶øURIÀàÐ͵IJÎÊý£¬½ÓÊܵÄÊÇURIÑùʽµÄString¡£Òò´Ë£¬Í¨¹ýURIת»»£¬»¹ÊÇ¿ÉÒÔ°ÑURIÑùʽµÄ¾ø¶Ô·¾¶ÓÃÔÚjava.io°üÖеÄÀàÖС£
¡¡¡¡Èý¡¢Ïà¶ÔÓÚclasspathµÄÏà¶Ô·¾¶
¡¡¡¡È磺Ïà¶ÔÓÚ
¡¡¡¡file:/D:/java/eclipse32/workspace/jbpmtest3/bin/Õâ¸ö·¾¶µÄÏà¶Ô·¾¶¡£ÆäÖУ¬binÊDZ¾ÏîÄ¿µÄclasspath¡£ËùÓеÄJavaÔ´Îļþ±àÒëºóµÄ.classÎļþ¸´ÖƵ½Õâ¸öĿ¼ÖС£
¡¡¡¡ËÄ¡¢Ïà¶ÔÓÚµ±Ç°Óû§Ä¿Â¼µÄÏà¶Ô·¾¶
¡¡¡¡¾ÍÊÇÏà¶ÔÓÚSystem.getProperty("user.dir")·µ»ØµÄ·¾¶¡£
¡¡¡¡¶ÔÓÚÒ»°ãÏîÄ¿£¬ÕâÊÇÏîÄ¿µÄ¸ù·¾¶¡£¶ÔÓÚJavaEE·þÎñÆ÷£¬Õâ¿ÉÄÜÊÇ·þÎñÆ÷µÄij¸ö·¾¶¡£Õâ¸ö²¢Ã»ÓÐͳһµÄ¹æ·¶£¡
¡¡¡¡ËùÒÔ£¬¾ø¶Ô²»ÒªÊ¹ÓÃ"Ïà¶ÔÓÚµ±Ç°Óû§Ä¿Â¼µÄÏà¶Ô·¾¶"¡£È»¶ø£º
¡¡¡¡Ä¬ÈÏÇé¿öÏ£¬java.io °üÖеÄÀà×ÜÊǸù¾Ýµ±Ç°Óû§Ä¿Â¼À´·ÖÎöÏà¶Ô·¾¶Ãû¡£´ËĿ¼ÓÉϵͳÊôÐÔ user.dir Ö¸¶¨£¬Í¨³£ÊÇ Java ÐéÄâ»úµÄµ÷ÓÃĿ¼¡£
¡¡¡¡Õâ¾ÍÊÇ˵£¬ÔÚʹÓÃjava.io°üÖеÄÀàʱ£¬×îºÃ²»ÒªÊ¹ÓÃÏà¶Ô·¾¶¡£·ñÔò£¬ËäÈ»ÔÚJ2SEÓ¦ÓóÌÐòÖпÉÄÜ»¹ËãÕý³££¬µ«Êǵ½ÁËJ2EE³ÌÐòÖУ¬Ò»¶¨»á³öÎÊÌ⣡¶øÇÒÕâ¸ö·¾¶£¬ÔÚ²»Í¬µÄ·þÎñÆ÷Öж¼ÊDz»Í¬µÄ£¡
¡¡¡¡Ïà¶Ô·¾¶×î¼Ñʵ¼ù
¡¡¡¡ÍƼöʹÓÃÏà¶ÔÓÚµ±Ç°classpathµÄÏà¶Ô·¾¶
¡¡¡¡Òò´Ë£¬ÎÒÃÇÔÚʹÓÃÏà¶Ô·¾¶Ê±£¬Ó¦µ±Ê¹ÓÃÏà¶ÔÓÚµ±Ç°classpathµÄÏà¶Ô·¾¶¡£
¡¡¡¡ClassLoaderÀàµÄgetResource(String name),getResourceAsStream(String name)µÈ·½·¨£¬Ê¹ÓÃÏà¶ÔÓÚµ


Ïà¹ØÎĵµ£º

JAVA System.getProperty()²ÎÊý


Java´úÂë < type="application/x-shockwave-flash" width="14" height="15" src="http://xiaoxinshome.javaeye.com/javascripts/syntaxhighlighter/clipboard_new.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" allowscriptaccess="always" quality="high" flashvars="clipboard=%20%20%20%20%20 ......

JavaÄÚ´æ¹ÜÀí»úÖÆÓëGC

 
JavaÊÇÈçºÎ¹ÜÀíÄÚ´æ
ΪÁËÅжÏJavaÖÐÊÇ·ñÓÐÄÚ´æй¶£¬ÎÒÃÇÊ×ÏȱØÐëÁ˽âJavaÊÇÈçºÎ¹ÜÀíÄÚ´æµÄ¡£JavaµÄÄÚ´æ¹ÜÀí¾ÍÊǶÔÏóµÄ·ÖÅäºÍÊÍ·ÅÎÊÌâ¡£ÔÚJavaÖУ¬³ÌÐòÔ±ÐèҪͨ¹ý¹Ø¼ü×ÖnewΪÿ¸ö¶ÔÏóÉêÇëÄÚ´æ¿Õ¼ä (»ù±¾ÀàÐͳýÍâ)£¬ËùÓеĶÔÏó¶¼ÔÚ¶Ñ (Heap)ÖзÖÅä¿Õ¼ä¡£ÁíÍ⣬¶ÔÏóµÄÊÍ·ÅÊÇÓÉGC¾ö¶¨ºÍÖ´Ðеġ£ÔÚJavaÖУ¬ÄÚ´æµÄ·ÖÅäÊ ......

Java¶ÔÏó¿½±´

public class Person implements Serializable {
    private String name;
    private int age;
    private GregorianCalendar birthday;
    public Person(){
       
    }
    p ......

ÓÃJava´úÂë²é¿´ÏµÍ³Ä¬ÈÏ×Ö·û¼¯±àÂë

public class EchoDefaultSystemEncoding
{
    public static void main(String[] args)
    {
           String encoding = System.getProperty("file.encoding");
           System ......

ÓÃÉè¼ÆģʽµÄ˼ÏëÀ´¶¨ÖÆJavaÖеÄʼþ

¼¶±ð£º ³õ¼¶
ÌÆ
ÏÌ·å
(hutun@263.net
),
2001 Äê 5 ÔÂ 28 ÈÕ
Ëæ×ÅJAVAµÄѸÃÍ·¢Õ¹£¬JDK°æ±¾µÄ²»¶Ï¸ü
У¬JAVAеÄʼþÄ£ÐÍÓë¾ÉµÄJDKÄ£ÐÍÒ²ÓÐÁ˱¾ÖʵÄÇø±ð£¬ËüµÄʼþÄ£ÐÍÒ²ÓÐÁ˺ܴóµÄÇø±ð¡£ÓÉÓÚÏÖÔڵıà³Ì¶¼ÊDzÉÓÃʼþÇý¶¯£¬ËùÒÔºÜÓбØÒªÁ˽âµÄʼþÄ£
ÐÍ£¬ÎÒÃÇÏÂÃæ´Ó¶¨ÖÆʼþµÄʵ¼Ê³ö·¢À´¾ßÌåÌÖÂÛ¡£
ÎÊÌâµÄÌá³ö
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ