<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    asdtiang的博客 感謝blogjava提供的博客交流平臺
    第一步:
    The installation procedure for both the old Java Comm v2 and the new Java Comm v3 is identical.

    Java Comm v2 is for Win32 systems and it is available on the Download page.

    Java Comm v3 is for Linux systems and it is available for download directly from SUN downloads (registration is required)

    To install it, unzip the downloaded archive file in a temporary place and do the following copies:

    File comm.jar should go under JDKDIR/jre/lib/ext/
    File javax.comm.properties should go under JDKDIR/jre/lib/
    Library files (i.e. win32com.dll for Win32 or the .so Linux library files) should go under JDKDIR/jre/bin/
    If you have a separate JRE directory, do the same copies for the JREDIR directory!

    即comm.jar導入引用包中,javax.comm.properties拷貝到JDKDIR/jre/lib/下,win32com.dll拷貝到 JDKDIR/jre/bin/下



    第二步:
    把相應的包導入就可以了。

    當時在做的時候,發(fā)現(xiàn)通過SMSLib發(fā)送程序還是比較麻煩的,他的日志采用的是slf4j,而slf4j是基于log4j的,這幾個不同的JAR包都是 在不同的地方下載的,在此所有的JAR整理出來,希望大家節(jié)約時間

    JAR包下載地址http://www.ziddu.com/download/7798641/phonesendmessageJAR.rar.html


    測試源碼:
    package org.asdtiang.phone.sendMessage;

    import org.smslib.IOutboundMessageNotification;
    import org.smslib.Message.MessageEncodings;
    import org.smslib.OutboundMessage;
    import org.smslib.modem.SerialModemGateway;

    public class Main {
    private static org.smslib.Service srv = new org.smslib.Service();;

    public static void creatService() {
    SerialModemGateway gateway 
    = new SerialModemGateway("SMS""COM3",
    9600"LENOVO""6070");
    gateway.setInbound(
    true);
    gateway.setOutbound(
    true);
    try {
    srv.addGateway(gateway);
    srv.startService();
    System.out.println(
    "Modem connected.");
    sendSms(
    "15100164985""測試用");
    catch (Exception ex) {
    ex.printStackTrace();
    }
    }

    public static org.smslib.Service getService() {
    if (srv == null) {
    creatService();
    }
    return srv;
    }

    public static void disconnect() {
    try {
    // srv.disconnect();

    System.out.println(
    "Modem disconnected.");
    catch (Exception ex) {
    ex.printStackTrace();
    }

    }

    public static void main(String args[]) {
    creatService();
    }

    public static boolean sendSms(String mobile, String content) {
    OutboundMessage msg 
    = new OutboundMessage(mobile, content);
    msg.setEncoding(MessageEncodings.ENCUCS2);
    try {
    srv.sendMessage(msg);
    System.out.println(msg);
    catch (Exception ex) {
    // log.error(ex);
    return false;
    }
    return true;
    }

    public void close() {
    try {
    srv.stopService();
    catch (Exception ex) {
    // log.error(ex);
    }
    }

    public class OutboundNotification implements IOutboundMessageNotification {
    public void process(String gatewayId, OutboundMessage msg) {
    System.out.println(
    "Outbound handler called from Gateway: "
    + gatewayId);
    System.out.println(msg);
    }
    }
    }



    天蒼蒼,野茫茫,風吹草底見牛羊

    posts - 80, comments - 24, trackbacks - 0, articles - 32

    Copyright © asdtiang

    asdtiang的博客 PaidMailz
    點擊廣告網(wǎng)賺A(每天4個廣告,每個0.0025美元,一個搜索廣告0.03美元)
    主站蜘蛛池模板: 亚洲欧洲免费无码| 亚洲精品天堂成人片AV在线播放| 看Aⅴ免费毛片手机播放| 毛片a级毛片免费播放100| 亚洲AV成人无码天堂| 精品成在人线AV无码免费看 | 中文字幕无码亚洲欧洲日韩| 18禁网站免费无遮挡无码中文| 亚洲国色天香视频| 啦啦啦中文在线观看电视剧免费版 | 亚洲国产91精品无码专区| 疯狂做受xxxx高潮视频免费| 亚洲日本中文字幕天堂网| yellow视频免费看| 亚洲AV无码1区2区久久| 1a级毛片免费观看| 亚洲区日韩精品中文字幕| 日韩中文字幕免费| 一级毛片免费视频网站| 亚洲av日韩综合一区在线观看| 8x网站免费入口在线观看| 亚洲午夜电影在线观看| 日韩成人免费aa在线看| 一级看片免费视频| 亚洲一区中文字幕久久| 日韩免费高清视频| 久久99久久成人免费播放| 亚洲综合精品一二三区在线| 最近免费中文字幕视频高清在线看 | 亚洲国产精品无码久久久秋霞2| 日韩人妻一区二区三区免费| 亚洲a视频在线观看| 亚洲福利精品电影在线观看| 一区二区三区观看免费中文视频在线播放| 亚洲乱码卡三乱码新区| 亚洲日韩在线中文字幕第一页| 免费人成视频在线观看网站| 亚洲av纯肉无码精品动漫| 亚洲AV无码久久寂寞少妇| 成人A级毛片免费观看AV网站| 插鸡网站在线播放免费观看|