public static void main(String[] args) {
		Enumeration<CommPortIdentifier> portList;
		CommPortIdentifier portId;
		String messageString = "Hello, world!\n";
		SerialPort serialPort = null;
		OutputStream outputStream = null;
		
		portList = getPortIdentifiers();

		while (portList.hasMoreElements()) {
			portId = (CommPortIdentifier) portList.nextElement();
			if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
				// if (portId.getName().equals("COM1")) {
				if (portId.getName().equals("/dev/term/a")) {
					try {
						serialPort = (SerialPort) portId.open("SimpleWriteApp", 2000);
					} catch (PortInUseException e) {
					}
					try {
						outputStream = serialPort.getOutputStream();
					} catch (IOException e) {
					}
					try {
						serialPort.setSerialPortParams(9600,
													   SerialPort.DATABITS_8, 
													   SerialPort.STOPBITS_1,
													   SerialPort.PARITY_NONE);
					} catch (UnsupportedCommOperationException e) {
					}
					try {
						outputStream.write(messageString.getBytes());
					} catch (IOException e) {
					}
				}
			}
		}
	}