JavaÖжÁÈ¡propertiesÎļþµÄ¼¸ÖÖ·½·¨
¡¡1¡¢Ê¹ÓÃjava.util.ResourceBundleÀàµÄgetBundle()·½·¨
ʾÀý£º
String name = "logging"; // the logging.properties file in src root folder
ResourceBundle rb = ResourceBundle.getBundle(name,Locale.getDefault());
// test the rb
String propertyKey = "xxx";
System.out.println(rb.getString(propertyKey));
¡¡2¡¢Ê¹ÓÃjava.util.PropertyResourceBundleÀàµÄ¹¹Ôì·½·¨
ʾÀý£º
String fileName = "src/logging.properties"; // the file path
InputStream in = new FileInputStream(fileName));
ResourceBundle rb = new PropertyResourceBundle(in);
// test the rb
String propertyKey = "xxx";
System.out.println(rb.getString(propertyKey));
¡¡3¡¢Ê¹ÓÃjava.util.PropertiesÀàµÄload()·½·¨
ʾÀý£º
String fileName = "src/logging.properties"; // the file path
InputStream in = new FileInputStream(fileName));
Properties prop = new Properties();
prop.load(in);
// test the prop
String propertyKey = "xxx";
System.out.println(prop.getProperty(propertyKey));
¡¡4¡¢Ê¹ÓÃclass±äÁ¿µÄgetResourceAsStream()·½·¨
ʾÀý£º
InputStream in = Properties.class.getResourceAsStream(name);
Properties p = new Properties();
p.load(in);
¡¡5¡¢Ê¹ÓÃclass.getClassLoader()ËùµÃµ½µÄjava.lang.ClassLoaderµÄgetResourceAsStream()·½·¨
ʾÀý£º
InputStream in = Properties.class.getClassLoader().getResourceAsStream(name);
Properties p = new Properties();
p.load(in);
¡¡6¡¢Ê¹ÓÃjava.lang.ClassLoaderÀàµÄgetSystemResourceAsStream()¾²Ì¬·½·¨
ʾÀý£º
InputStream in = ClassLoader.getSystemResourceAsStream(name);
Properties p = new Properties();
p.load(in);
¡¡7¡¢ServletÖпÉÒÔʹÓÃjavax.servlet.ServletContextµÄgetResourceAsStream()·½·¨
ʾÀý£º
InputStream in = context.getResourceAsStream(path);
Properties p = new Properties();
p.load(in);
Ïà¹ØÎĵµ£º
[ת]Java´òÓ¡³ÌÐòÉè¼ÆÈ«¹¥ÂÔ
2008-12-07 18:43
Ç°ÑÔ
¡¡¡¡ÔÚÎÒÃǵÄʵ¼Ê¹¤×÷ÖУ¬¾³£ÐèҪʵÏÖ´òÓ¡¹¦ÄÜ¡£µ«ÓÉÓÚÀúÊ·ÔÒò£¬JavaÌṩµÄ´òÓ¡¹¦ÄÜÒ»Ö±¶¼±È½ÏÈõ¡£Êµ¼ÊÉÏ×î³õµÄjdk¸ù±¾²»Ö§³Ö´òÓ¡£¬Ö±µ½jdk1.1²ÅÒýÈëÁ˺ÜÇáÁ¿µÄ´òÓ¡Ö§³Ö¡£ËùÒÔ£¬ÔÚÒÔÇ°ÓÃJava/Applet/JSP/ServletÉè¼ÆµÄ³ÌÐòÖУ¬½Ï¸´ÔӵĴòÓ¡¶¼ÊÇͨ¹ýµ÷ÓÃActiveX/OCX¿ ......
ÔÚ¡¶JDBC Driver For SQL2000/2005/2008
¡·Ò»ÎÄÖУ¬ÑûÔ½éÉÜÁËÈçºÎÏÂÔز¢Ê¹ÓÃjdbcÁ¬½ÓSQL Server,
½ñÌìÓÐÈËÎÊÆð£¬ÈçºÎÒÔwindows¼¯³É·½Ê½Á¬½ÓSQL Server,Õâ¸öÒÔÇ°ÕæûÊÔ¹ý¡£
ÓÚÊÇ£¬´ò¿ªnetBeans²âÊÔÁËһϣ¬´úÂëÈçÏ£º
/*
* To change this template, choose Tools | Templates
* and open the template in the edit ......
±È½ÏPHPºÍJSPÕâÁ½¸öWeb¿ª·¢¼¼Êõ,ÔÚÄ¿Ç°µÄÇé¿öÊÇÆäʵÊDZȽÏPHPºÍJavaµÄWeb¿ª·¢.ÒÔÏÂÊÇÎҾͼ¸¸öÖ÷Òª·½Ãæ½øÐеıȽÏ:
Ò». ÓïÑԱȽÏ
PHPÊǽâÊÍÖ´ÐеķþÎñÆ÷½Å±¾ÓïÑÔ,Ê×ÏÈphpÓмòµ¥ÈÝÒ×ÉÏÊÖµÄÌصã.Óï·¨ºÍcÓïÑԱȽÏÏó,ËùÒÔѧ¹ýcÓïÑԵij ......
Ï̳߳ØͨË×µÄÃèÊö¾ÍÊÇÔ¤ÏÈ´´½¨Èô¸É¿ÕÏÐỊ̈߳¬µÈµ½ÐèÒªÓöàÏß³ÌÈ¥´¦ÀíÊÂÎñµÄʱºòÈ¥»½ÐÑijЩ¿ÕÏÐÏß³ÌÖ´Ðд¦ÀíÈÎÎñ£¬ÕâÑù¾ÍÊ¡È¥ÁËƵ·±´´½¨Ï̵߳Äʱ¼ä£¬ÒòΪƵ ·±´´½¨Ïß³ÌÊÇÒªºÄ·Ñ´óÁ¿µÄCPU×ÊÔ´µÄ¡£Èç¹ûÒ»¸öÓ¦ÓóÌÐòÐèҪƵ·±µØ´¦Àí´óÁ¿²¢·¢ÊÂÎñ£¬²»¶ÏµÄ´´½¨Ïú»ÙÏß³ÌÍùÍù»á´ó´óµØ½µµÍϵͳµÄЧÂÊ£ ......