Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

COM PORTS are not shows under 64bit OS on eclipse indigo

 
Rahul Naik
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,

Below Java program for detecting ports of PC. I am using eclipse indigo as IDE. program runs correctly but detected ports are not shows in console out put. i am using 64bit processor. JDK 1.6. i try JDK for 64bit but not working. i added all jar file RXTXComm.jat, rxtxParallel.dll, rxtxSerial.dll in the program. Please advice asap

import java.io.*;
import java.util.*;
import javax.comm.*;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import javax.comm.CommPort;
import javax.comm.CommPortIdentifier;
import javax.comm.SerialPort;

public class SimpleWrite {
static Enumeration portList;
static CommPortIdentifier portId;
static String messageString = "Hello, world!\n";
static SerialPort serialPort;
static OutputStream outputStream;

public static void main(String[] args) {
portList = CommPortIdentifier.getPortIdentifiers();
while (portList.hasMoreElements())
{
portId = (CommPortIdentifier) portList.nextElement();
if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL)
System.out.println("Port Name : "+portId);
{
System.out.println("Port Name : "+portId);

if (portId.getName().equals("COM3"))
{
//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)
{}
}
}
}
}
}

 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic