java»ñÈ¡Ò³Ãæ±àÂë
http://babyjoycry.javaeye.com/blog/587527
1. import info.monitorenter.cpdetector.io.CodepageDetectorProxy;
2. import info.monitorenter.cpdetector.io.HTMLCodepageDetector;
3. import info.monitorenter.cpdetector.io.JChardetFacade;
4.
5. import java.io.BufferedReader;
6. import java.io.IOException;
7. import java.io.InputStreamReader;
8. import java.net.HttpURLConnection;
9. import java.net.URL;
10. import java.util.Iterator;
11. import java.util.List;
12. import java.util.Map;
13. import java.util.Set;
14.
15. public class WebEncoding {
16. private static CodepageDetectorProxy detector = CodepageDetectorProxy
17. .getInstance();
18. static {
19.
20. detector.add(new HTMLCodepageDetector(false));
21.
22. detector.add(JChardetFacade.getInstance());
23.
24. }
25. /** ²âÊÔÓÃÀý
26. * @param args
27. */
28. public static void main(String[] args) {
29. WebEncoding web=new WebEncoding();
30. try {
31. System.out.println(web.getCharset("http://www.pujia.com/"));
32. } catch (IOException e) {
33. // TODO Auto-generated catch block
34. e.printStackTrace();
35. }
36. }
37. /**
38. * @param strurl
39. * Ò³ÃæurlµØÖ·,ÐèÒªÒÔ http://¿ªÊ¼£¬Àý£ºhttp: //www.pujia.com
40. * @return
41. * @throws IOException
42. */
43. public String getCharset(String strurl) throws IOException {
44. // ¶¨ÒåURL¶ÔÏó
45. URL url = new URL(strurl);
46. // »ñÈ¡httpÁ¬½Ó¶ÔÏó
47. HttpURLConnection urlConnection = (HttpURLConnection) url
48. .openConnection();
49. ;
50. urlConnection.connect();
51. // ÍøÒ³±àÂ
Ïà¹ØÎĵµ£º
ÔÚjavaÖÐÓÐ3¸öÀàÀ´¸ºÔð×Ö·ûµÄ²Ù×÷¡£
1.Character ÊǽøÐе¥¸ö×Ö·û²Ù×÷µÄ£¬
2.String ¶ÔÒ»´®×Ö·û½øÐвÙ×÷¡£²»¿É±äÀà¡£
3.StringBuffer Ò²ÊǶÔÒ»´®×Ö·û½øÐвÙ×÷£¬µ«ÊǿɱäÀà¡£
String:
ÊǶÔÏó²»ÊÇÔʼÀàÐÍ.
Ϊ²»¿É±ä¶ÔÏó,Ò»µ©±»´´½¨,¾Í²»ÄÜÐÞ¸ÄËüµÄÖµ.
¶ÔÓÚÒѾ´æÔÚµÄString¶ÔÏóµÄÐÞ¸ ......
ÔÚjavaµ÷ÓÃexe£¬com¿ÉÖ´ÐÐÎļþºÍbat£¬cmdÅú´¦ÀíÎļþ
Ò»¡£ÔËÐÐexeÎļþ
1. Java JDKÀïÒѾÌṩÁ˵÷Óõķ½·¨£¬²»ÔÚÀÛ׸£¬´úÂëÈçÏ¡£
try {
String command = "notepad";
& ......
½«java±àÖ¯³É.classºó£¬Èç¹ûÖ»ÊÇÓÃjavaÃüÁîÀ´Ö´ÐÐ×ܾõµÃ²»ÊÇÌ«¹ýñ«£¬ÕÒ¸ö°ì·¨Éú³ÉÏñexeÎļþÒ»ÑùÓÃÊó±êË«»÷±ã¿ÉÖ´ÐеÄÎļþ£¬Ó¦¸ÃÊǺÜÓÐȤµÄ°¡¡£ÕâÀïÎÒÓÃÁËÒ»¸öÃû×Ö½Ð×öexe4jµÄÃâ·ÑСÈí¼þ£¬¸Ð¾õ²»´í¡£
¡¡¡¡Ê×ÏÈ£¬µ±È»ÊÇÒªÏÂÔØ¸öexe4j¡£ÎÒµÄÊÇ2.2°æ±¾µÄ£¬license£ºL-g782dn2d-1f1yqxx1rv1sqd¡£
¡¡¡¡½Ó×Å£¬½«ÄãҪѡÔñºÃÄã¼´½« ......
ClassLoaderÒ»¸ö¾³£³öÏÖÓÖÈúܶàÈËÍû¶øÈ´²½µÄ´Ê£¬±¾ÎĽ«ÊÔͼÒÔ×îdzÏÔÒ×¶®µÄ·½Ê½À´½²½â ClassLoader£¬Ï£ÍûÄܶԲ»Á˽â¸Ã»úÖÆµÄÅóÓÑÆðµ½Ò»µãµã×÷Óá£
ÒªÉîÈëÁ˽âClassLoader£¬Ê×ÏȾÍÒªÖªµÀClassLoaderÊÇÓÃÀ´¸ÉʲôµÄ£¬¹ËÃû˼Ò壬Ëü¾ÍÊÇÓÃÀ´¼ÓÔØClassÎļþµ½JVM£¬ÒÔ¹©³ÌÐòʹÓõġ£ÎÒÃÇÖªµÀ£¬java³ÌÐò¿ÉÒÔ¶¯Ì¬¼ÓÔØÀඨÒå£ ......
public static void getConnAndTableStruct() {
Connection connection = null;
PreparedStatement pstmt = null;
ResultSetMetaData rsmd = null;
try {
// mysqlÁ¬½Ó
//Class.forName("org.gjt.mm.mysql.Driver");
//connection = DriverManager.g ......