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")·µ»ØµÄ·¾¶¡£
¶ÔÓÚÒ»°ãÏîÄ¿£
Ïà¹ØÎĵµ£º
Java ½Ó¿ÚºÍ³éÏóÀàÇø±ð ÊÕ²Ø
À´Ô´ http://blog.csdn.net/sunboard/archive/2009/01/18/3831823.aspx
Ò»¸öÈí¼þÉè¼ÆµÄºÃ»µ£¬ÎÒÏëºÜ´ó³Ì¶ÈÉÏÈ¡¾öÓÚËüµÄÕûÌå¼Ü¹¹£¬¶øÕâ¸öÕûÌå¼Ü¹¹Æäʵ¾ÍÊÇÄã¶ÔÕû¸öºê¹ÛÉÌÒµÒµÎñµÄ³éÏó¿ò¼Ü£¬µ±´ú±íÒµÎñÂß¼µÄ¸ß²ã³éÏó²ã½á¹¹ ºÏÀíʱ£¬Äãµ×²ãµÄ¾ßÌåʵÏÖÐèÒª¿¼Âǵľͽö½öÊÇһЩËã·¨ºÍһЩ¾ßÌåµÄÒµ ......
1.ÉùÃ÷°ü£ºpackage °üÃû
¸ÃÓï¾äÊÇ×÷ΪjavaÔ´ÎļþµÄµÚÒ»ÌõÓï¾ä Ö¸Ã÷¸ÃÔ´Îļþ¶¨ÒåµÄÀàËùÔڵİü
2.µ¼°ü£ºimport °üÃû
¸ÃÓï¾ä±ØÐëдÔÚpackageÓï¾äºÍÔ´Îļ ......
1.//propertyÎļþµÄ¶ÁÈ¡
//com.test.messageÎļþ
package com.test;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
public class Test_Messages {
private static final String BUNDLE_NAME = "com.test.messages";
private static final ResourceBundle RESOURCE_BUNDLE = Reso ......
ÔÚJAVAÖУ¬ÓÐÁù¸ö²»Í¬µÄµØ·½¿ÉÒÔ´æ´¢Êý¾Ý£º
1. ¼Ä´æÆ÷£¨register£©¡£ÕâÊÇ×î¿ìµÄ´æ´¢Çø£¬ÒòΪËüλÓÚ²»Í¬ÓÚÆäËû´æ´¢ÇøµÄµØ·½——´¦ÀíÆ÷ÄÚ²¿¡£µ«ÊǼĴæÆ÷µÄÊýÁ¿¼«ÆäÓÐÏÞ£¬ËùÒԼĴæÆ÷ÓɱàÒëÆ÷¸ù¾ÝÐèÇó½øÐзÖÅä¡£Äã²»ÄÜÖ±½Ó¿ØÖÆ £¬Ò²²»ÄÜÔÚ³ÌÐòÖиоõµ½¼Ä´æÆ÷´æÔÚµÄÈκμ£Ïó¡£
2. ¶ÑÕ»£¨stack£©¡£Î»ÓÚͨÓÃRAMÖУ¬µ ......
½ñÌìûʸɡ££¬ÄÃJavaÖеÄmainº¯ÊýÀ´Ịֽ̀¬¡£¡£»¹ÇëÖîλָµã°¡£¬£¬
public static void main(String args [])
{
.....
}
ÕâÊÇ´ó¼ÒÒ»°ãµÄд·¨°É£¬ÕâÀïÎÒÏëÌ̵ֽÄÖ÷ÒªÓÐÒÔϼ¸µã£º
1.ËüµÄ²ÎÊýÎÊÌ⣬ÄǸö²ÎÊýµ¹µ×ÓкÎÓÃÄØ£¬£¬ÕâÊǺÜÁîÈËÃÔ»óµÄ£¬ÕâÀï×Ô¼ºÐ´Á˸öÀý×ÓÊÔÁËһϣ¬µ«ÊdzöÏÖÁËÒì³££º
class A
{
......