java ²å¼þ¼ÓÔØ
package tao.hai.bing;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
public class LoadJar {
public static void main(String[] args)
{
System.out.println(System.getProperty("user.dir"));
String uri = "file:/G:/java/tao.jar";
try {
URL url = new URL(uri);
URLClassLoader loader = new URLClassLoader(new URL[]{url});
Class myClass = loader.loadClass("tao.hai.bing.print.Press");
Object object = myClass.newInstance();
Method method = myClass.getMethod("myPress", String.class);
method.invoke(object, "taohaibing22");
System.out.println(myClass.getName());
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (SecurityException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
Ïà¹ØÎĵµ£º
1.factoryÒòΪ¹¤³§Ä£Ê½¾ÍÏ൱ÓÚ´´½¨ÊµÀý¶ÔÏóµÄnew£¬ÎÒÃǾ³£Òª¸ù¾ÝÀàClassÉú³ÉʵÀý¶ÔÏó£¬
ÈçA a=new A() ¹¤³§Ä£Ê½Ò²ÊÇÓÃÀ´´´½¨ÊµÀý¶ÔÏóµÄ£¬ËùÒÔÒÔºónewʱ¾ÍÒª¶à¸öÐÄÑÛ£¬ÊÇ·ñ¿ÉÒÔ¿¼ÂÇʵÓù¤³§Ä£Ê½£¬
ËäÈ»ÕâÑù×ö£¬¿ÉÄܶà×öһЩ¹¤×÷£¬µ«»á¸øÄãϵͳ´øÀ´¸ü´óµÄ¿ÉÀ©Õ¹ÐԺ;¡Á¿ÉÙµÄÐÞ¸ÄÁ¿¡£
2.PrototypeģʽÔÊÐíÒ»¸ö¶ÔÏóÔÙ´´½¨Á ......
Day 01
Ò»¡¢ ´ÓÃæÏò¹ý³Ì±à³Ìµ½ÃæÏò¶ÔÏó±à³ÌµÄ˼άת±ä
ÎÒÃÇÖªµÀËùÓеļÆËã»ú³ÌÐò¶¼ÊÇÓÉÁ½ÀàÔªËØ×é³É£º´úÂëºÍÊý¾Ý¡£´ËÍâ´Ó¸ÅÄîÉϽ«½²£¬³ÌÐò»¹¿ÉÒÔÒÔËûµÄ´úÂë»òÊÇÊý¾ÝΪºËÐĽøÐÐ×éÖ¯±àд¡£Ò²¾ÍÊÇ˵һЩ³ÌÐòΧÈÆ“ÕýÔÚ·¢Éúʲô±àд“£¬¶øÁíһЩ³ÌÐòÔòΧÈƔ˽«±»Ó°Ï쓱àд¡£ÕâÁ½ÖÖ· ......
1.
ÓÐÕâÑùÒ»ÖÖ˵·¨£¬Èç½ñÕù·æÓÚITÕ½³¡µÄÁ½´óÊÆÁ¦£¬MSÒ»×åÆ«ÖØÓڵײãʵÏÖ£¬JavaÒ»×åÆ«ÖØÓÚϵͳ¼Ü¹¹¡£Ëµ·¨¸ù¾ÝÎÞ´Ó¿¼Ö¤£¬µ«´ÓÁ½´óÊÆÁ¦¸÷×ÔµÄÉçÇøÁ¦Á¿ºÍͼÊéÊг¡ÒÑÓмÑ×÷²»ÄÑ¿´³ö£¬´Ë˵·¨²»Ð飬µ«ÕÆÎÕJavaµÄµ×²ãʵÏÖ¶ÔJava³ÌÐòÔ±À´ËµÊÇÖÁ¹ØÖØÒªµÄ£¬±¾ÎĽéÉÜÁËJavaÖеÄÊý¾ÝÔÚÄÚ´æÖеĴ洢¡£
¡¡¡¡
¡¡¡¡2 ÄÚ´æÖ ......
ÔÚSuse10.1Ï°²×°EOS5.3£¬½çÃæ°´Å¥·²ÖÐÎĶ¼ÊÇ·½¸ñ£¬¿ÉÔÚÖն˲鿴ÖÐÎĶ¼ÊǺõģ¬ÍøÉÏËÑÁ˺ü¸Ì죬ÖÕÓÚŪÃ÷°×ÔÒò¡£
EOS5.3ʹÓõÄÊÇjdk1.4.2£¬ÔÚsuseÏÂûÓÐjdkĬÈÏÒªÇóµÄÖÐÎÄ×ÖÌ壬ÐèÒª×ö¶îÍâµÄÅäÖã¬Ð޸ķ½·¨ÈçÏ£º
1.ʹÓÃsuÃüÁîÇл»ÎªrootÓû§£¬ÔÙʹÓÃcdÃüÁîÇл»µ½jdk°²×°Â·¾¶ÏµÄjre£»ÀýÈ磺
......