Ok the idea is that i want to use serial communication in java, using javax.comm. What i want to do exactly is read a line though serial communication and save it in an array. For example every time i press a button on my external device, it will send a line of random numbers like "12345", if i press it again, should send another line of numbers. I want my java program to read that line save it into an array, then get ready to receive another line of numbers and save that in another array for late use. If there is any tip or someone can atleast help me getting connected with serial would be great. Thank You. So far i have the following, which finds ports.
HTML Code:import java.util.Enumeration; import javax.comm.CommPortIdentifier; public class PortAccess { CommPortIdentifier commPortIdentifier; Enumeration enumeration; public void fnListPorts() { try { enumeration = CommPortIdentifier.getPortIdentifiers(); } catch (Exception e) { e.printStackTrace(); } while (enumeration.hasMoreElements()) { commPortIdentifier = (CommPortIdentifier) enumeration.nextElement(); System.out.println(commPortIdentifier.getName()); } } public static void main(String[] args) { PortAccess portAccess = new PortAccess(); portAccess.fnListPorts(); } }