D:\program\classes\JBuilder2006\jdk1.5\bin\javaw -classpath "E:\work\LAOAN\SMSModel\classes;E:\work\LAOAN\SMSModel\supportlib\comm.jar;D:\program\classes\JBuilder2006\jdk1.5\jre\lib\deploy.jar;D:\program\classes\JBuilder2006\jdk1.5\jre\lib\rt.jar;D:\program\classes\JBuilder2006\jdk1.5\jre\lib\plugin.jar;D:\program\classes\JBuilder2006\jdk1.5\jre\lib\javaws.jar;D:\program\classes\JBuilder2006\jdk1.5\jre\lib\ext\dnsns.jar;D:\program\classes\JBuilder2006\jdk1.5\jre\lib\ext\sunpkcs11.jar;D:\program\classes\JBuilder2006\jdk1.5\jre\lib\ext\localedata.jar;D:\program\classes\JBuilder2006\jdk1.5\jre\lib\ext\sunjce_provider.jar;D:\program\classes\JBuilder2006\jdk1.5\jre\lib\jsse.jar;D:\program\classes\JBuilder2006\jdk1.5\jre\lib\jce.jar;D:\program\classes\JBuilder2006\jdk1.5\jre\lib\charsets.jar;D:\program\classes\JBuilder2006\jdk1.5\jre\lib\im\thaiim.jar;D:\program\classes\JBuilder2006\jdk1.5\jre\lib\im\indicim.jar;D:\program\classes\JBuilder2006\jdk1.5\lib\jconsole.jar;D:\program\classes\JBuilder2006\jdk1.5\lib\tools.jar;D:\program\classes\JBuilder2006\jdk1.5\lib\dt.jar;D:\program\classes\JBuilder2006\jdk1.5\lib\htmlconverter.jar" -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=new:1922,suspend=y com.sms.test.test
Error loading SolarisSerial: java.lang.UnsatisfiedLinkError: no SolarisSerialParallel in java.library.path
Caught java.lang.UnsatisfiedLinkError: readRegistrySerial while loading driver com.sun.comm.SolarisDriver
Error loading SolarisSerial: java.lang.UnsatisfiedLinkError: no SolarisSerialParallel in java.library.path
Caught java.lang.UnsatisfiedLinkError: readRegistrySerial while loading driver com.sun.comm.SolarisDriver
大家出现过这个错误吗?
Error loading SolarisSerial: java.lang.UnsatisfiedLinkError: no SolarisSerialParallel in java.library.path
Caught java.lang.UnsatisfiedLinkError: readRegistrySerial while loading driver com.sun.comm.SolarisDriver
Error loading SolarisSerial: java.lang.UnsatisfiedLinkError: no SolarisSerialParallel in java.library.path
Caught java.lang.UnsatisfiedLinkError: readRegistrySerial while loading driver com.sun.comm.SolarisDriver
大家出现过这个错误吗?
解决方案 »
- 如何得到JavaMelody的监控数据???
- 求求各位大神,帮小弟解决下问题....>.<
- 线程的死锁
- 如何取得指定的int型数据中某一位的二进制值(1还是0)
- SSH框架,Action中复杂自定义方法调用问题?--看看有收获
- 简单问题求解!
- 求一个jar包
- 使用JMS传递XML格式的数据,应该使用哪些api?JAXP? SAX? JDOM? DOM? Xerces? Weblogic.XMLMessage ?
- Asp 的内置对象request.ServerVariables改成Jsp的内置对象问题
- 求助关于java.lang.StackOverflowError的解决方法
- 小弟诚心请教各位大哥~~~关于传真服务器识别传真机
- SessionBean 与 hibernate 问题
+CMGS: 143OK
这个发送成功了吗?怎么查询发送成功。但是手机没有收到。
Enumeration en = CommPortIdentifier.getPortIdentifiers(); CommPortIdentifier portId; while (en.hasMoreElements()) { portId = (CommPortIdentifier) en.nextElement(); /*如果端口类型是串口,则打印出其端口信息*/ if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { System.out.println(portId.getName()); } }
实现这个功能,需要两个jar包,可以到http://code.google.com/p/smslib下载smslib-v3.3.0-B2-bin.zip和javacomm20-win32.zip。
首先,把smslib-v3.3.0-B2-bin.zip解开,在smslib\dist\lib目录下找到smslib-3.3.0b2.jar,放入工程lib中,再把javacomm20-win32.zip解开,里面的comm.jar需要放到工程lib下,javax.comm.properties放到%JAVA_HOME%/jre/lib下,win32com.dll放到%JAVA_HOME%/jre/bin下。路径放错了,调用起来就会报错的。
环境配置好了以后,使用起来很简单,贴下我的代码:
// SendMessage.java - Sample application.
//
// This application shows you the basic procedure for sending messages.
// You will find how to send synchronous and asynchronous messages.
//
// For asynchronous dispatch, the example application sets a callback
// notification, to see what's happened with messages.
package song.test;
import org.smslib.IOutboundMessageNotification;
import org.smslib.Library;
import org.smslib.OutboundMessage;
import org.smslib.Service;
import org.smslib.Message.MessageEncodings;
import org.smslib.modem.SerialModemGateway;
public class SendMessage
{
public void doIt() throws Exception
{
Service srv;
OutboundMessage msg;
OutboundNotification outboundNotification = new OutboundNotification();
System.out.println("Example: Send message from a serial gsm modem.");
System.out.println(Library.getLibraryDescription());
System.out.println("Version: " + Library.getLibraryVersion());
srv = new Service();
SerialModemGateway gateway = new SerialModemGateway("modem.com1", "COM1", 115200, "wavecom", "17254");
gateway.setInbound(true);
gateway.setOutbound(true);
gateway.setSimPin("0000");
gateway.setOutboundNotification(outboundNotification);
srv.addGateway(gateway);
srv.startService();
System.out.println("Modem Information:");
System.out.println(" Manufacturer: " + gateway.getManufacturer());
System.out.println(" Model: " + gateway.getModel());
System.out.println(" Serial No: " + gateway.getSerialNo());
System.out.println(" SIM IMSI: " + gateway.getImsi());
System.out.println(" Signal Level: " + gateway.getSignalLevel() + "%");
System.out.println(" Battery Level: " + gateway.getBatteryLevel() + "%");
System.out.println();
// Send a message synchronously.
msg = new OutboundMessage("13649251175", "这个是用java发的中文短信!");//手机号码,和短信内容
msg.setEncoding(MessageEncodings.ENCUCS2);//这句话是发中文短信必须的
srv.sendMessage(msg);
System.out.println(msg);
System.out.println("Now Sleeping - Hit <enter> to terminate.");
System.in.read();
srv.stopService();
}
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);
}
}
public static void main(String args[])
{
SendMessage app = new SendMessage();
try
{
app.doIt();
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
C:\Java\jdk1.6.0_10\bin>java SendMessage
Example: Send message from a serial gsm modem.
SMSLib: A Java API library for sending and receiving SMS via a GSM modem or othe
r supported gateways.
This software is distributed under the terms of the Apache v2.0 License.
Web Site: http://smslib.org
Version: 3.4.6
- 请问什么原因?