我正在运行一个服务器应用程序并访问数据库进行操作,即使我在项目中配置了javax.comm.properties
,我也会收到错误
javax.comm: Can't find javax.comm.properties!
java.io.IOException: javax.comm: platform driver class name = null
(Check 'driver' property in javax.comm.properties)
at javax.comm.CommPortIdentifier.loadDriver(CommPortIdentifier.java:244)
at javax.comm.CommPortIdentifier.<clinit>(CommPortIdentifier.java:109)
at com.rtc.actions.downloads.MySerialPort.openMyPort(MySerialPort.java:88)
at com.rtc.actions.downloads.Downloads.<init>(Downloads.java:70)
at com.rtc.actions.downloads.MasterDownloadAction.execute(MasterDownloadAction.java:37)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
javax.comm.properties
应放置在JAVA_HOME/jre/lib/ext
中,请参阅详细信息。
使用此软件包的第一步是将正确的文件放入HOME的相应目录文件夹。
1) win32com.dll:保存在JAVA_HOME的bin目录中。就我而言将其放置在C:\Program Files\Java\jdk1.6.0_05\jre\bin
2) comm.jar:将其放在JAVA_HOME的lib\ext目录中。我的在C: \Program Files\Java\jdk1.6.0_05\jre\lib\ext
3) javax.comm.properties:同上。所以这个文件进入C: \Program Files\Java\jdk1.6.0_05\jre\lib\ext