Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

µ÷ÓÃGoogle API µÄJavaʵÏÖ£¨Web service£©


Web ServiceµÄ·Ï»°¾Í²»ËµÁË¡£¾Í˵ÔõôʹÓðɡ£
1.ÐèÒªjava»·¾³ µ½http:.//java.sun.com/J2SE  ¿ÉÒÔÏÂÔØ Java Development Kit
2.ÐèÒªGoogle APIµÄJarÎļþ£¬Googleapi.jar¡£¿ÉÒÔµ½http://www.google.com/apisÏÂÔØ¡£Ìî¼Ó½øCLASSPATH.
3.ÉêÇëGoogle·ÃÎÊÕʺţ¬Ä¿Ç°GoogleÖ§³ÖÃâ·ÑÉêÇëµÄ·½Ê½£¬Óû§ÐèҪʹÓÃÒ»¸öemailÕʺÅÀ´»ñÈ¡ÐÂÕʺš£×¢Ò⣬ĿǰÃâ·ÑÕʺÅÖ§³ÖÿÌì1000ÌõµÄ×î´ó²éѯÁ¿¡£ÉêÇëµØÖ·£ºhttp://www.google.com/apis¡£
   ÉêÇëÒÔºóÈ¥ÓÊÏäÀïÆôÓÃÄãµÄÕÊ»§£¬È»ºó»áÓÐÁíÒ»·âemail·¢µ½ÓÊÏäÀï¡£µÃµ½ÄãµÄlicense key ¡£
SOAPÇëÇóµÄ¸ñʽ¾Í²»ËµÁË£¬googleÖ±½ÓÌṩÁËapi.±ðÀË·ÑÁËGoogleapi.jarŶ.
4.ÒÔÏÂÊÇÀý×Ó
package daxigua;
import com.google.soap.search.*;
import java.io.*;
public class GoogleAPITest {
    public static void main(String[] args) {
        String clientKey = "clientKey";//¸Õ²ÅµÃµ½µÄlicense key ,²»ÊÇÕÊ»§ÃûŶ
        String query = "csdn";
        GoogleSearch s = new GoogleSearch();
        s.setKey(clientKey);
        try {
            s.setQueryString(query);
            s.setLanguageRestricts("lang_cn");
            GoogleSearchResult r = s.doSearch();
            System.out.println("Google Search Results:" + r.toString());
            FileWriter fw = new FileWriter("result.txt");
            fw.write(r.toString());
            fw.close();
        } catch (GoogleSearchFault f) {
            System.ou


Ïà¹ØÎĵµ£º

Java data ×ܽá

1.¼ÆËãijһÔ·ݵÄ×î´óÌìÊý
Calendar time=Calendar.getInstance();
time.clear();
time.set(Calendar.YEAR,year); //year Ϊ int
time.set(Calendar.MONTH,i-1);//×¢Òâ,Calendar¶ÔÏóĬÈÏÒ»ÔÂΪ0
int day=time.getActualMaximum(Calendar.DAY_OF_MONTH);//±¾Ô·ݵÄÌìÊý
×¢£ºÔÚʹÓÃset·½·¨Ö®Ç°£¬±ØÐëÏÈ ......

Java¾ø¶ÔºÃÎÄ

1£® ¹ØÓÚ¶¯Ì¬¼ÓÔØ»úÖÆ??
ѧϰJava±ÈC++¸üÈÝÒ×Àí½âOOPµÄ˼Ï룬±Ï¾¹C++»¹»ìºÏÁ˲»ÉÙÃæÏò¹ý³ÌµÄ³É·Ö¡£ºÜ¶àÈ˶¼Äܱ³³öÀ´JavaÓïÑÔµÄÌص㣬ËùνµÄ¶¯Ì¬¼ÓÔØ»úÖƵȵȡ£µ±È»¸ÅÄîÍùÍùÊÇÏȼÇס¶øºóÏû»¯µÄ£¬¿ÉÓжàÉÙÈËÕæÕýÈ¥Ìå»á¹ý¶¯Ì¬¼ÓÔصĻúÖÆ£¬ÊÔͼȥѰÕÒ¹ýÆäÖеÄϸ½ÚÄØ? Ìṩ´ó¼ÒÒ»¸ö·½·¨£º
ÔÚÃüÁîÐд°¿ÚÔËÐÐJava³ÌÐòµÄʱºò£¬¼ ......

Java Socket

×î½üÑо¿ÏÂsocket,ctrl+vÁËÏÂÍøÉϵĶ«Î÷:
   ÊÂʵÉÏÍøÂç±à³Ì¼òµ¥µÄÀí½â¾ÍÊÇÁ½Ì¨¼ÆËã»úÏ໥ͨѶÊý¾Ý¶øÒÑ¡£¶ÔÓÚ³ÌÐòÔ±¶øÑÔ£¬È¥ÕÆÎÕÒ»ÖÖ±à³Ì½Ó¿Ú²¢Ê¹ÓÃÒ»ÖÖ±à³ÌÄ£ÐÍÏà¶Ô¾Í»áÏԵüòµ¥µÄ¶àÁË¡£Java SDKÌṩһЩÏà¶Ô¼òµ¥µÄApiÀ´Íê³ÉÕâЩ¹¤×÷£¬Socket¾ÍÊÇÆäÖÐÖ®Ò»¡£
¡¡¡¡¶ÔÓÚJava¶øÑÔ¡£ÕâЩApi´æÔÚÓëJava.netÕâ¸ö ......

javaÐÂÌØÐÔ ÐÂʽforÑ­»·(For_Each)

  package com.test.For_Each;
¡¡¡¡import java.util.ArrayList;
¡¡¡¡import java.util.Iterator;
¡¡¡¡import java.util.List;
¡¡¡¡public class ForTest
¡¡¡¡{
¡¡¡¡public static void main(String args[])
¡¡¡¡{
¡¡¡¡int arr[] = {1, 2, 3, 4, 5, 6, 7, 8};
¡¡¡¡/**
¡¡¡¡* ÐÂʽд·¨
¡¡¡¡*/
¡¡¡¡f ......

µÚÒ»´Î×öJava web ÏîÄ¿

  Õâ¶Ìʱ¼ä£¬Íê³ÉÁËÒ»¸ö½ÏΪ¼òµ¥µÄϵͳ Ò»¸ö½ÌÓýÅàѵ»ú¹¹µÄÐÅÏ¢¹ÜÀíϵͳ£¬Ö÷ÒªÊÇͨ¹ý²»Í¬µÄ½ÇÉ«·ÖÅä½øÈ벻ͬµÄ½çÃ棬×öÏàÓ¦µÄ¹¤×÷£¬ÒòΪÔÚȨÏÞ·½Ã滹ûŪºÃ£¬Ã»ÓÐÓõ½Ajax¡£½ÇÉ«ÓÐϵͳ¹ÜÀíÔ±£¬×ÉѯÖ÷¹Ü£¬×Éѯʦ£¬Êг¡×¨Ô±£¬Êг¡²¿Ö÷¹Ü£¬ÁªÏµÈË£¬µÈµÈ¡£ÒòΪµ±³õдµÄʱºò£¬ÏµÍ³µÄÀ©Õ¹ÐÔ»¹¿ÉÒÔ£¬ËùÒÔÄã¿ÉÒÔÔö¼ÓÒ»¸ö½ÇÉ«£¬ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ