Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: SerialPort

  1. #1
    Junior Member
    Join Date
    Apr 2023
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default SerialPort

    Hello everybody

    I try to build this code . But, I have every time error. Can you help me?

    package Main;



    import com.fazecast.jSerialComm.SerialPorts;

    public class Starter {

    public static void main(String[] args) {

    System.out.println("Hello world");

    SerialPort[] ports = SerialPort.getCommPorts();

    for (SerialPort port: ports) {
    System.out.println(port.getSystemPortName());
    }

    }

    }

    Thanks

  2. #2
    Member Helium c2's Avatar
    Join Date
    Nov 2023
    Location
    Kekaha, Kaua'i
    Posts
    88
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: SerialPort

    Hi...

    Where is this package or class file located? You might have to write an exception. Not for the files but for this class file. Try { catch ( ) } //used to debug errors.
    So add something. Like Systems.out.println( " " ) ; Then compile it.

Similar Threads

  1. concurrency over serialport object in RXTX
    By michelekapp in forum What's Wrong With My Code?
    Replies: 0
    Last Post: February 4th, 2014, 06:09 AM