In Java projects, you often need to read configuration information from the configuration file. Common configuration files include properties files and XML files. This document takes reading the properties configuration file as an example.
The screenshot of the configuration file app. properties is as follows:
ftp.username=userOneftp.password=p@sswordftp.hostip=127.0.0.1ftp.port=21
Load and read the Configuration:
Import org. apache.
ObjectiveBefore you have learned the Apache Commons beanutils package propertyutils and dynamic beans, the next will learn the remaining several tools, the personal feel is very practical, especially collectionutils;BeanutilsA brief introduction to the use of the next two methods, populate and Copyproperties,Populate can help us copy the value of the key value in the map to the bean's attribute value;Copypr
This uses Apache Commons compress to extract the. tar.z format files.For a file Test.tar.z, we can understand the decompression process as:
Unzip the test.tar.z into Test.tar;
Unzip the Test.tar to test.
According to an example of Apache Commons compress:Extract. Z File Example:inputstream fin = Files
Basic object Pool not found: "Java.lang.noclassdeffounderror:org/apache/commons/pool/impl/genericobjectpool" workaround
question: Org.springframework.beans.factory.BeanCreationException:Error creating Bean with Name ' DataSource ' defined in ServletContext resource [/web-inf/classes/applicationcontext.xml]: instantiation of Bean failed; Nested exception is java.lang.NoClassDefFoundError:Org/
Apache Commons is a very useful toolkit to solve a variety of practical common problems, here is a summary table, detailed information access to http://jakarta.apache.org/commons/index.htmlBeanutilsCommons-beanutils provides packaging for the Java reflection and introspection APIBetwixtBETWIXT provides services that map JavaBean to XML documents, as well as to th
Apache Commons is a very useful toolkit to solve a variety of practical common problems, here is a summary table,More Information Access http://jakarta.apache.org/commons/index.htmlBeanutilsCommons-beanutils provides packaging for the Java reflection and introspection APIBetwixtBETWIXT provides services that map JavaBean to XML documents, as well as to the opposi
jar package version of the problem, I see a lot of information on the Internet can be with parameters to upload files.I hope the great God can help me solve the above problems.2. Then Apache httpclient upload, on the codeCloseablehttpclient httpClient = Httpclients.createdefault (); HttpPost HttpPost = new HttpPost (URL); listNo accident, success, you can continue the following work, hahahaSummary of the differences between
Introduction to Apache Commons StringUtilsHot 4 already 1529 read 2012-05-06 21:27 tags: Apache apache commons stringutils Introduction
org.apache.commons.lang.StringUtils
StringUtils is a tool class in the Apache
Quartz error:Caused by: Java. Lang. nosuchmethoderror: org. Apache. commons. Collections. setutils. orderedset (ljava/util/set;) ljava/util/set;The reason is that the use of the commons-collections.jar version is too low caused by the use of 3.For those using myeclipse, if the commons-collections.jar is imported 3. * T
Apache Commons VFS Data:Example: http://www.zihou.me/html/2011/04/12/3377.htmlDetailed Example: http://p7engqingyang.iteye.com/blog/1702429Apache Commons VFS: File system Tools, do not come from the file system with different files to operate, can handle non-local files (VFS, the original FTP sometimes does not normally shut down the situation,
Refer to Region
Exception in thread "Main" Java. lang. noclassdeffounderror: ORG/Apache/commons/collections/MAP/listorderedmap
Later I checked and found that there was a packet error. The following six packages are commonly used in JSON.
Commons-logging-1.0.4.jar
And if the commons-collections-3.2.jar
Commons is a Java sub-project in the Apache open source code organization. This project mainly involves some common modules, such as file upload, command line processing, database connection pool, and xml configuration file processing. These projects bring together the painstaking efforts of software engineers from all over the world, and their performance and stability have all stood the test of practical
tmpfile = tmpdir + system.getproperty ("file.separator") + "test.tmp";InputStream in = new Java.io.FileInputStream (tmpfile);
Recommended:
File Tmpdir = new file ("/var/tmp");File Tmpfile = new file (Tmpdir, "test.tmp");InputStream in = new Java.io.FileInputStream (tmpfile);
3.2Buffered Streams IO Performance relies on buffering policies. In general, it is very fast to read packets of size up to or from a byte, because these sizes match the packet size i
The following exception occurred during the unit test on SSH today:
SEVERE: Exception starting filter Struts2java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtilsat com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:211)at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:102)at com.ope
Apache commons is a very useful toolkit to address a variety of practical general problems, below is a brief table, detailed information access http://jakarta.apache.org/commons/index.html
BeanutilsCommons-beanutils provides packaging for Java reflection and introspection APIs
BetwixtBetwixt provides JavaBean ing to XML documents and reverse ing services.
C
Propertiesconfiguration.defaultiofactory{/*** Return to our developed property reader*/Public Propertiesreader Createpropertiesreader (Reader in, Char delimiter){return new Whitespacepropertiesreader (in, delimiter);}}
Finally we have to create a new instance of the Iofactory implementation and pass in the Propertiesconfiguration object. This must be done before the load () method call. So we can't use constructors to load data. The code for setting up the configuration object should look
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.