JavaÅäÖÃÎļþ¶ÁÈ¡
JavaÅäÖÃÎļþ¶ÁÈ¡Óи÷ÖÖ²»Í¬µÄÎļþ£¬µ«ÊÇÓÉÓÚ´ò°üJarºóµÄ·¾¶¸Ä±ä£¬ÍùÍùÔÚÏîÄ¿ÖÐÄÜÕýÈ·¶ÁÈ¡µÄÅäÖÃÎļþÔÚJarºó±ä³ÉÎļþ²»´æÔڵı¾ß£¬ÏÂÔÚÌá³ö¼¸¸÷²»Í¬µÄÅäÖÃÎļþ¶ÁÈ¡·½Ê½£¬½ö¹©²Î¿¼
Ò»¡¢Ö±½ÓÎļþ¶ÁÈ¡
File f = new File("you config file path");
FileReader fr = new FileReader(f);
BufferReader br = new BufferReader(fr);
String str = br.readLine();
String para = null;
while(str != null){
//here to get the parameter in the line by key
String para = getPara(key);
return para ;
}
ÕâÖÖ·½Ê½µÄºÃ´¦ÊÇÅäÖÃÎļþ¿ÉÒÔ×Ô¼ºÏëÒªµÄ·½Ê½´æÔÚ£¬ÈçiniÎļþ£¬Èçkey = value£¬»òkey:valueµÈ£¬Ö»Òª×Ô¼ºÄܽâÊÍ¡£
µ«£¬ÓÉÓÚ·¾¶µÄÎÊÌ⣬ºÍ¶ÁȡȨÏÞ£¬ÍùÍùÍùÍùÔÚÏîÄ¿ÖÐÄÜÕýÈ·¶ÁÈ¡µÄÅäÖÃÎļþÔÚJarºó±ä³ÉÎļþ²»´æÔڵı¾ß
¶þ¡¢²ÉÓÃProperties
DataInputStream dis = ClassLoader.getResourceAsStream("your config file path");
Properties p = new Properties() ;
p.load(dis );
//here get the para value by key
getResource(key) ;
ÕâÖÖ·½·¨¼õÉÙÁËÒ»ÖÐȡÿ¸öÊôÐÔ´øÀ´ºÍ·±ÔÓ¹ý³Ì£¬µ«ÒÀÈ»ÎÞ·¨½â¾ö·¾¶±ä»¯µÄÎÊÌâ
Èý¡¢×Ô¶¯Ñ°ÕÒ£¬×Ô¶¯¶ÁÈ¡
ResourceBundle rb = ResourceBundle.getBundle("your config file name");
//get value of key
rb.getString(key);
ÕâÖÖ·½Ê½×Ô¶¯Ñ°ÕÒÅäÖÃÎļþ£¬×Ô¶¯¶ÁÈ¡ÊôÐÔ
Èý¡¢beanģʽ
1.ÀûÓÃClassPathXmlApplicationContext
ApplicationContext context = new ClassPathXmlApplicationContext("beanConfig.xml");HelloBean helloBean = (HelloBean)context.getBean("helloBean");System.out.println(helloBean.getHelloWorld());
2.ÀûÓÃFileSystemResource¶ÁÈ¡
Resource rs = new FileSystemResource("D:/software/tomcat/webapps/springWebDemo/WEB-INF/classes/beanConfig.xml"); BeanFactory factory = new XmlBeanFactory(rs); HelloBean helloBean = (HelloBean)factory.getBean("helloBean"); System.out.println(helloBean.getHelloWorld());
Ïà¹ØÎĵµ£º
Cavaj Java Decompiler is a graphical freeware utility that reconstructs Java source code from CLASS files. You can decompile Java applets, JAR and ZIP files, producing accurate Java source code. Browse the reconstructed source code with the Class View for instant access to methods and fields. The pr ......
1.1 °²×°JDK
1.1.1 ÏÂÔØJDK
´ò¿ªhttp://java.sun.com/ÍøÕ¾£¬ÔÚĿ¼ÀïÃæÑ¡ÔñDownload£¬ÔÚÏÂÀ²Ëµ¥ÖÐÑ¡ÔñJava SE
½øÈëÏÂÒ»¸öÒ³Ãæ£¬ÒªÑ¡ÔñÏÂÔØJDK£¬¶ø²»ÒªÏÂÔØJRE£º
½ÓÏÂÀ´ÊÇÑ¡ÔñÔËÐÐµÄÆ½Ì¨£¬ÕâÀﵱȻÊÇÑ¡ÔñlinuxÁË£º
Ñ¡ÔñºÃƽ̨ºó£¬µã»÷continue:
ÕâÀï¿ÉÒÔÖ±½Óµ ......
±¾ÈË´Óʽü10ÄêµÄjava¿ª·¢£¬×ܽáÒ»Ì×ÓÐЧµÄjavaʵսÊÓÆµ½Ì³Ì£¬°üÀ¨£ºjava»ù´¡¡¢jspÅàѵ¡¢strutsʹÓá¢hibernateʹÓúÍspringµÄʹÓ㬻¹°üº¬´óÁ¿µÄÅàѵ´úÂ룬ÒÔ¼°sshÕûºÏ¿ª·¢È«¹ý³Ì¡£±¾Ì×ÊÓÆµ5Ô·ݾͽ«Â¼ÖÆÍê³É£¬Èç¹ûÄúÓÐÒâÇëÁªÏµÎÒ£¬ÎÒµÄQQ£º1429154728 ......
ΪÁË×öµ½Ê¹µÃ³ÌÐò¾ßÓиü¸ßµÄÁé»îÐÔ£¬¿ÉÅäÖÃÐÔ£¬ÔÚ¿ª·¢ÖÐÎÒÃǾ³£ÀûÓ÷´ÉäÀ´´´½¨Ò»¸öÀàµÄʵÀý£¬Ò²¾ÍÊÇ»ñµÃÒ»¸öÀàµÄÒ»¸ö¶ÔÏó£¡Í¨³£µÄ×ö·¨ÊÇͨ¹ýclass.newInstance»ñµÃ£»µ«ÕâÖÖ·½·¨ÓÐÒ»¸ö²»ºÃµÄµØ·½£¬ÄǾÍÊÇËûÖ»ÄÜ´´½¨Î޲ι¹ÔìÆ÷µÄ¶ÔÏó£¬Èç¹û¹¹ÔìÆ÷ÓвÎÊýÄÇËüÊÇÎÞÄÜΪÁ¦µÄ£»½â¾öµÄ·½·¨¾ÍÊÇ ÏÈͨ¹ý¸ÃÀàµÄClass»ñµÃ´øÓвΠ......