Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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³ÌÐò·â×°³ÉEXEÎļþ

 ¿ÉÒÔ°ÑÆÕͨµÄJava³ÌÐò×ö³ÉÕæÕýµÄexe,Ò²¾ÍÊǵ¥Ò»¸öexe¾Í¿ÉÒÔÔÚûÓа²×°JVMµÄ»úÆ÷ÉÏÔËÐС£ÕâÑùµÄ¹¤¾ß³£¼ûµÄÓÐJETºÍgcj.Ç°ÕßÊÇÊշѵģ¬¶øÇÒ×ö³öÀ´µÄexe»¹ÊÇÐèÒªÒ»¶Ñdll¡£ÍƼöʹÓÃgcj.ËûÓÐwindowsºÍLinux°æ£¬Ö±½ÓÏÂÔØzip°ü£¬²»ÐèÒª°²×°£¬ÀïÃæÓв»ÉÙÀý×Ó£¬Ò»Ð©buildµÄÅú´¦ÀíÎļþ¡£´ÓÔ­ÀíÀ´Ëµgcj×Ô¼ºÊµÏÖÁËJVM¹æ·¶£¬Ò²¾ÍÊÇÄ ......

Java´òÓ¡³ÌÐòÉè¼ÆÈ«¹¥ÂÔ

[ת]Java´òÓ¡³ÌÐòÉè¼ÆÈ«¹¥ÂÔ
2008-12-07 18:43
Ç°ÑÔ
¡¡¡¡ÔÚÎÒÃǵÄʵ¼Ê¹¤×÷ÖУ¬¾­³£ÐèҪʵÏÖ´òÓ¡¹¦ÄÜ¡£µ«ÓÉÓÚÀúÊ·Ô­Òò£¬JavaÌṩµÄ´òÓ¡¹¦ÄÜÒ»Ö±¶¼±È½ÏÈõ¡£Êµ¼ÊÉÏ×î³õµÄjdk¸ù±¾²»Ö§³Ö´òÓ¡£¬Ö±µ½jdk1.1²ÅÒýÈëÁ˺ÜÇáÁ¿µÄ´òÓ¡Ö§³Ö¡£ËùÒÔ£¬ÔÚÒÔÇ°ÓÃJava/Applet/JSP/ServletÉè¼ÆµÄ³ÌÐòÖУ¬½Ï¸´ÔӵĴòÓ¡¶¼ÊÇͨ¹ýµ÷ÓÃActiveX/OCX¿ ......

java±¸·Ýsql serverÊý¾Ý¿â ´æ´¢¹ý³Ì

½ñÌì¸ø´ó¼Ò·ÖÏíÒ»ÏÂÈçºÎ±¸·ÝºÍ»Ø¸´sql server Êý¾Ý£¬
Ê×ÏÈÈ·±£Äã¾ßÓÐDBµÄ×î¸ßȨÏÞ
ÔÚJAVA´úÂëÖÐ Äã¿ÉÒÔÕâÑùдpublic class Opp extends TestCase{
public void test1()
{
try
{
Connection con = DBUtils.getConn();
String sql="backup database tdzl to disk='d:\\tdzl.bak'";
Statement st = con.c ......

Java ¶ÔÏóµÄ´æ´¢Î»ÖÃ

ժѡ×Ô¡¶Java±à³Ì˼Ïë¡·
1£® ¼Ä´æÆ÷£¨register£©¡£ÕâÊÇ×î¿ìµÄ´æ´¢Çø£¬ÒòΪËüλÓÚ²»Í¬ÓÚÆäËû´æ´¢ÇøµÄµØ·½——´¦ÀíÆ÷ÄÚ²¿¡£µ«ÊǼĴæÆ÷µÄÊýÁ¿¼«ÆäÓÐÏÞ£¬ËùÒԼĴæÆ÷ÓɱàÒëÆ÷¸ù¾ÝÐèÇó½øÐзÖÅä¡£Äã²»ÄÜÖ±½Ó¿ØÖÆ£¬Ò²²»ÄÜÔÚ³ÌÐòÖиоõµ½¼Ä´æÆ÷´æÔÚµÄÈκμ£Ïó¡£
2£®¶ÑÕ»£¨stack£©¡£Î»ÓÚͨÓÃRAM£¨random-access memory£¬ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ