java classLoader Ìåϵ½á¹¹
jvm classLoader architecture£º
1. Bootstrap ClassLoader/Æô¶¯Àà¼ÓÔØÆ÷
Ö÷Òª¸ºÔðjdk_home/libĿ¼ÏµĺËÐÄ api »ò -Xbootclasspath Ñ¡ÏîÖ¸¶¨µÄjar°ü×°È빤×÷¡£
2. Extension ClassLoader/À©Õ¹Àà¼ÓÔØÆ÷
Ö÷Òª¸ºÔðjdk_home/lib/extĿ¼ÏµÄjar°ü»ò -Djava.ext.dirs Ö¸¶¨Ä¿Â¼ÏµÄjar°ü×°È빤×÷¡£
3. System ClassLoader/ϵͳÀà¼ÓÔØÆ÷
Ö÷Òª¸ºÔðjava -classpath/-Djava.class.pathËùÖ¸µÄĿ¼ÏµÄÀàÓëjar°ü×°È빤×÷¡£
4. User Custom ClassLoader/Óû§×Ô¶¨ÒåÀà¼ÓÔØÆ÷(java.lang.ClassLoaderµÄ×ÓÀà)
ÔÚ³ÌÐòÔËÐÐÆÚ¼ä, ͨ¹ýjava.lang.ClassLoaderµÄ×ÓÀද̬¼ÓÔØclassÎļþ, ÌåÏÖjava¶¯Ì¬ÊµÊ±Àà×°ÈëÌØÐÔ¡£
Àà¼ÓÔØÆ÷µÄÌØÐÔ£º
1. ÿ¸öClassLoader¶¼Î¬»¤ÁËÒ»·Ý×Ô¼ºµÄÃû³Æ¿Õ¼ä£¬ ͬһ¸öÃû³Æ¿Õ¼äÀï²»ÄܳöÏÖÁ½¸öͬÃûµÄÀà¡£
2. ΪÁËʵÏÖjava°²È«É³ÏäÄ£ÐͶ¥²ãµÄÀà¼ÓÔØÆ÷°²È«»úÖÆ, javaĬÈϲÉÓÃÁË " Ë«Ç×ίÅɵļÓÔØÁ´ " ½á¹¹¡£
classloader-architecture
classloader-architecture
classloader-class-diagram
classloader-class-diagram
ÀàͼÖУ¬ BootstrapClassLoaderÊÇÒ»¸öµ¥¶ÀµÄjavaÀ࣬ ÆäʵÔÚÕâÀ ²»Ó¦¸Ã½ÐËûÊÇÒ»¸öjavaÀà¡£ÒòΪ£¬ËüÒѾÍêÈ«²»ÓÃjavaʵÏÖÁË¡£ËüÊÇÔÚjvmÆô¶¯Ê±£¬ ¾Í±»¹¹ÔìÆðÀ´µÄ£¬ ¸ºÔðjavaƽ̨ºËÐÄ¿â¡£
×Ô¶¨ÒåÀà¼ÓÔØÆ÷¼ÓÔØÒ»¸öÀàµÄ²½Öè
classloader-load-class
classloader-load-class
ClassLoader Àà¼ÓÔØÂß¼·ÖÎö£¬ ÒÔÏÂÂß¼Êdzý BootstrapClassLoader ÍâµÄÀà¼ÓÔØÆ÷¼ÓÔØÁ÷³Ì£º
1. // ¼ì²éÀàÊÇ·ñÒѱ»×°Ôعý
2. Class c = findLoadedClass(name);
3. if (c == null ) {
4. // Ö¸¶¨Ààδ±»×°Ôعý
5. try {
6. if (parent != null ) {
7. // Èç¹û¸¸Àà¼ÓÔØÆ÷²»Îª¿Õ£¬ ÔòίÅɸø¸¸Àà¼ÓÔØ
8. c = parent.loadClass(name, false );
9. } else {
10. // Èç¹û¸¸Àà¼ÓÔØÆ÷Ϊ¿Õ£¬ ÔòίÅɸøÆô¶¯Àà¼ÓÔؼÓÔØ
11. c = findBootstrapClass0(name);
12. }
13. } catch (ClassNotFoundException e) {
14. // Æô¶¯Àà¼ÓÔØÆ÷»ò¸¸Àà¼ÓÔØÆ÷Å׳öÒì³£ºó£¬ µ±Ç°Àà¼ÓÔØÆ÷½«Æä
15. // ²¶»ñ£¬ ²¢Í¨¹ýfindClass·½·¨£¬ ÓÉ×ÔÉí¼ÓÔØ
16. c = findClass(name);
17. }
18.
Ïà¹ØÎĵµ£º
Jsp
·½Ãæ
jspµÄ³£ÓõÄÃüÁî´ð£ºpage, include, talib, forward,
Servlet
·½Ãæ
1
¡¢ËµÒ»Ëµ
Servlet
µÄÉúÃüÖÜÆÚ
?
´ð:servletÓÐÁ¼ºÃ
µÄÉú´æÆڵĶ¨Ò壬°üÀ¨¼ÓÔغÍʵÀý»¯¡¢³õʼ»¯¡¢´¦ÀíÇëÇóÒÔ¼°·þÎñ½áÊø¡£Õâ¸öÉú´æÆÚÓÉjavax.servlet.Servlet½Ó¿ÚµÄ
init,serviceºÍdestroy·½·¨±í´ï¡£
2
¡¢
Servlet
°æ±¾¼ä
(
ÍüÁ ......
java.util
Àà Random
java.lang.Object
java.util.Random
ËùÓÐÒÑʵÏֵĽӿڣº
Serializable
Ö±½ÓÒÑÖª×ÓÀࣺ
SecureRandom
public class Random
extends Object
implements Serializable
´ËÀàµÄʵÀýÓÃÓÚÉú³ÉαËæ»úÊýÁ÷¡£´ËÀàʹÓà 48 λµÄÖÖ×Ó£¬Ê¹ÓÃÏßÐÔͬÓ๫ʽ¶ÔÆä½øÐÐÐ޸ģ¨Çë²ÎÔÄ Donald Knuth µÄ ......
public static String splitAndFilterString(String input, int length) {
if (input == null || input.trim().equals("")) {
&nb ......
ÔÎĵØÖ·£ºhttp://www.javaeye.com/topic/626801 Ò»Ö±ÔÞ̾Sun¶Ô´ý¼¼ÊõµÄÑϽ÷ºÍÓÅÑÅ£¨¿ÉÁ¯µÄSun£©¡£Sun JDKÖÐJava¿âµÄÔ´´úÂ룬Á¬×¢ÊͶ¼ÇåÇå³þ³þ¡¢¹æ¹æ·¶·¶£¬javadoc×¢½âµÄʹÓÃҲһ˿²»¹¶£¬¶ÁÆðÀ´ºÜÊìÊæ·þ¡£Òò´Ë£¬ÔÚÈÕ³£¹¤×÷ºÍѧϰÖУ¬¾³£¶Á¶Á Java¿âµÄÔ´´úÂ룬²»ÒàÀÖºõ£¿Èç¹ûÓöµ½¹îÒìÎÊÌ⣬Դ´úÂë ......
½«ÏÂÔغóµÄÎļþ½â°ü£¬µÃµ½jxl.jar£¬·ÅÈëclasspath£¬°²×°¾ÍÍê³ÉÁË¡£
»ù±¾²Ù×÷
Ò»¡¢´´½¨Îļþ
ÄâÉú³ÉÒ»¸öÃûΪ“²âÊÔÊý¾Ý.xls”µÄExcelÎļþ£¬ÆäÖеÚÒ»¸ö¹¤×÷±í±»ÃüÃûΪ“µÚÒ»Ò³”£¬´óÖÂЧ¹ûÈçÏ£º
´úÂ루CreateXLS.java£©£º
//Éú³ÉExcelµÄÀà
import java.io.*;
import jxl.*;
import jxl.write. ......