简体   繁体   中英

How to import javax.comm API to Netbeans IDE?

I am writing a program to read and write from and to serial port of a system using Java in Netbeans IDE. I am working with Ubuntu 14.04 operating system. Actually I am a beginner in java programming. I have downloaded comm-linux_all-2.0.0.jar from oracle's home site and it is copied to workspace directory.

After all these things I imported the API using the command

   import javax.comm.*;

But it shows the error "Package javax.comm does not exit."

What would be the problem, please help me to resolve the problem.

extract comm-linux_all-2.0.0.jar the files

somewhere in the NetBeans directory.

Here we take the following directory. (you know the path on ubuntu)

\\NetBeans80\\extra\\modules

RXTXcomm.jar
comm.jar

Now open Netbeans : tools -> libraries

  • create a new lbrary here : comm-linux_all-2.0.0
  • click Add JAR/Folder
  • nav.to the folder where the files are.

在此处输入图片说明

  • open the project -> Properties
  • select Libraries
  • click Add Library ...
  • select the just created comm-linux_all-2.0.0 Library

在此处输入图片说明


  • copy librxtxSerial.so and librxtxParallel.so to /usr/bin folder.

now you can use.

import javax.comm.*;
....
public class JustaClass {
....

You can check the pom.xml file.
I had the same problem (I am a rookie)
I didn't add the dependencies :

<dependency>
  <groupId>javax.servlet</groupId>
  <artifactId>javax.servlet-api</artifactId>
  <version>4.0.1</version>
</dependency>                

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM