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

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 Óë c# ¶Ô±È ˼¿¼

´ÓʱàÂë7Äê¶àÁË
¶ÔÓÚjava ºÍc# ÎÒÓÐ×Å×Ô¼ºµÄÀí½â
ÔÚ2009ÄêµÄ9ÔÂÕâ¸öʱ¼äµãÎÒ¿´À´java  c#ÊÇÐÂʽÓïÑԵĴú±í
{ÒòΪÎÒÈÏΪ¼ÆËã»úµÄ·¢Õ¹Àú³ÌÊÇ
µÚÒ»½×¶Î ´ò¿×»ú(¶þ½øÖÆ),
µÚ2½×¶Î »ã±à, (±È¶þ½øÖÆ·½±ãµÄÓïÑÔ),
µÚ3½×¶Î c (¸üÒ×ÓÚ¿´Ã÷°×µÄ¸ß¼¶ÓïÑÔ),
µÚ4½×¶ÎµÚ1²ã c++ (´Ó¶ÔÏó½Ç¶ÈÀí½âµÄ¸ß¼¶ÓïÑÔ),
µÚ4½×¶ÎµÚ2² ......

Javaµ÷Óô洢¹ý³Ì


 
 
 
Javaµ÷Óô洢¹ý³Ì
±¾ÎIJûÊöÁËÔõôʹÓÃDBMS´æ´¢¹ý³Ì¡£ÎÒ²ûÊöÁËʹÓô洢¹ý³ÌµÄ»ù±¾µÄºÍ¸ß¼¶ÌØÐÔ£¬±ÈÈç·µ»ØResultSet¡£±¾ÎļÙÉèÄã¶ÔDBMSºÍJDBCÒѾ­·Ç³£ÊìϤ£¬Ò²¼ÙÉèÄãÄܹ»ºÁÎÞÕϰ­µØÔĶÁÆäËüÓïÑÔд³ÉµÄ´úÂ루¼´²»ÊÇJavaµÄÓïÑÔ£©£¬µ«ÊÇ£¬²¢²»ÒªÇóÄãÓÐÈκδ洢¹ý³ÌµÄ±à³Ì¾­Àú¡£
´æ´¢¹ý³ÌÊÇÖ¸±£´æÔÚ ......

javaÖÐÈçºÎÒÔwindows¼¯³É·½Ê½Á¬½ÓSQL Server

ÔÚ¡¶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 ......

JavaʵÏÖͨÓÃÏ̳߳Ø

      Ï̳߳ØÍ¨Ë×µÄÃèÊö¾ÍÊÇÔ¤ÏÈ´´½¨Èô¸É¿ÕÏÐỊ̈߳¬µÈµ½ÐèÒªÓöàÏß³ÌÈ¥´¦ÀíÊÂÎñµÄʱºòÈ¥»½ÐÑijЩ¿ÕÏÐÏß³ÌÖ´Ðд¦ÀíÈÎÎñ£¬ÕâÑù¾ÍʡȥÁËÆµ·±´´½¨Ï̵߳Äʱ¼ä£¬ÒòΪƵ ·±´´½¨Ïß³ÌÊÇÒªºÄ·Ñ´óÁ¿µÄCPU×ÊÔ´µÄ¡£Èç¹ûÒ»¸öÓ¦ÓóÌÐòÐèҪƵ·±µØ´¦Àí´óÁ¿²¢·¢ÊÂÎñ£¬²»¶ÏµÄ´´½¨Ïú»ÙÏß³ÌÍùÍù»á´ó´óµØ½µµÍϵͳµÄЧÂÊ£ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ