JAVA¶ÁÈ¡Íⲿ×ÊÔ´µÄ·½·¨
ÔÚjava´úÂëÖо³£ÓжÁÈ¡Íⲿ×ÊÔ´µÄÒªÇó:ÈçÅäÖÃÎļþµÈµÈ,ͨ³£»á°ÑÅäÖÃÎļþ·ÅÔÚclasspathÏ»òÕßÔÚwebÏîÄ¿ÖзÅÔÚweb-infÏÂ.
1.´Óµ±Ç°µÄ¹¤×÷Ŀ¼ÖжÁÈ¡:
try {
BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream("wkdir.txt")));
String str;
while ((str = in.readLine()) != null) {
System.out.println(str);
}
in.close();
} catch (IOException e) {
}
2,´ÓclasspathÖжÁÈ¡(¶ÁÈ¡ÕÒµ½µÄµÚÒ»¸ö·ûºÏÃû³ÆµÄÎļþ):
try {
InputStream stream = ClassLoader.getSystemResourceAsStream("fileinjar.txt");
BufferedReader in = new BufferedReader(new InputStreamReader(stream));
String str;
while ((str = in.readLine()) != null) {
System.out.println(str);
}
in.close();
} catch (IOException e) {
}
3,´ÓclasspathÖжÁÈ¡(¶ÁÈ¡ÕÒµ½µÄËùÓзûºÏÃû³ÆµÄÎļþ,ÈçSpringÖдøÓÐclasspath*:ǰ׺µÄÇé¿ö¾Í»á´ÓclasspathÖбéÀú):
try {
Enumeration resourceUrls = Thread.currentThread().get
Ïà¹ØÎĵµ£º
ÔÚJavaÖУ¬²»Í¬µÄÀ඼ÓÐ×Ô¼ºµ¥¶ÀµÄCache»úÖÆ£¬ÊµÏֵķ½·¨Ò²¿ÉÄÜÓÐËù²»Í¬£¬ÎÄÕÂÁоÙÁËJavaÖг£¼ûµÄ¸÷ÀàCache»úÖƵÄʵÏÖ·½·¨£¬Í¬Ê±½øÐÐÁË×ۺϵıȽϡ£
OSCache
OSCacheÊǸöÒ»¸ö¹ã·º²ÉÓõĸßÐÔÄܵÄJava EE»º´æ¿ò¼Ü£¬OSCacheÄÜÓÃÓÚÈκÎJavaÓ¦ÓóÌÐòµÄÆÕͨµÄ»º´æ½â¾ö·½°¸¡£
OSCacheÓÐÒÔÏÂÌص㣺»º´æÈκζÔÏó£¬Äã¿ÉÒÔ²»ÊÜÏÞÖƵ ......
MysqlÔÚĬÈÏÇé¿öϽ¨Á¢±íµÄ×Ö·û±àÂëÊÇlatin1£¬ËùÒÔÔÚ²åÈëÖÐÎÄʱ»á³ö´í¡£
eg£º
1¡¢²é¿´±í½¨Á¢µÄsqlÔ´Â룺
1: sqlÃüÁshow create table users
2:
3: ½á¹û£º
4: CREATE TABLE `users` (
5: `userID` int(10) unsigned NOT NULL AUTO_INCREMENT,
6: `userName` varchar(4 ......
JavaÅäÖÃÎļþ¶ÁÈ¡Óи÷ÖÖ²»Í¬µÄÎļþ£¬µ«ÊÇÓÉÓÚ´ò°üJarºóµÄ·¾¶¸Ä±ä£¬ÍùÍùÔÚÏîÄ¿ÖÐÄÜÕýÈ·¶ÁÈ¡µÄÅäÖÃÎļþÔÚJarºó±ä³ÉÎļþ²»´æÔڵı¾ß£¬ÏÂÔÚÌá³ö¼¸¸÷²»Í¬µÄÅäÖÃÎļþ¶ÁÈ¡·½Ê½£¬½ö¹©²Î¿¼
Ò»¡¢Ö±½ÓÎļþ¶ÁÈ¡
File f = new File("you config file path");
FileReader fr = new FileReader(f);
BufferReader br = new ......
ÔÚʹÓÃhibernate»òÕßspringµÄʱºò£¬ÎÒÃÇÍùÍùͨ¹ýÅäÖÃÎļþÅäÖÃÊý¾Ý¿âÁ¬½ÓÊôÐÔ¡£µ«Õâ´ÎÏîÄ¿Öв¢Ã»ÓÐÓõ½hibernateºÍspring£¬Ö»Óõ½ÁËstruts2¡£ÒªÈçºÎʵÏÖͨ¹ý¶ÁÈ¡ÎļþÅäÖûñÈ¡ÊôÐÔÖµÄØ£¿ResourceBundleÕâ¸öÀà¿ÉÊÇʵÏÖ¶ÁÈ¡propertiesÎļþÀ´»ñÈ¡Öµ
ÔÚjavaÖУº
public final static Object initLock = new Object();
privat ......