Ukiya006 0 Newbie Poster

Hi,
I am pretty new to Java, only started learning bits here and there last Sept.
Recently, I have been trying to implement a SMS sender with the help of RXTXcomm.jar
What I didn't realise was that the RXTXcomm.jar that I have only works for 32bit Windows.
I only realise it when I tried it on my friend's 64bit Windows.

I did google and I found a 64bit version on http://www.cloudhopper.com/opensource/rxtx/
but placing them in the various places of the jdk folders, it still doesn't work.

I am not sure it's because of the rxtxSerial.dll or not..
as on the 64bit version.. there's a readme file that says

rxtxSerial.dll had to be recomopiled to link in missing native methods.

But I have no idea what does that mean.

This is a code that I have been trying out that is suppose to show the comm ports available.
It works well on my 32 bit. but on the 64 bit, i did a print line on ports.hasMoreElements() and it keep showing false.

Enumeration ports = CommPortIdentifier.getPortIdentifiers();
while (ports.hasMoreElements()) {
CommPortIdentifier port = (CommPortIdentifier)ports.nextElement();
String type;
switch (port.getPortType()) {
case CommPortIdentifier.PORT_PARALLEL:
type = "Parallel";
break;
case CommPortIdentifier.PORT_SERIAL:
type = "Serial";
break;
default: /// Shouldn't happen
type = "Unknown";
break;
}
System.out.println(port.getName() + ": " + type);
}

I went to google once again, and I found this snippet of codes from http://rxtx.qbang.org/wiki/index.php/Discovering_available_comm_ports
but it doesn't work too or rather nothing appear.

/**
     * @return    A HashSet containing the CommPortIdentifier for all serial ports that are not currently being used.
     */
    public static HashSet<CommPortIdentifier> getAvailableSerialPorts() {
        HashSet<CommPortIdentifier> h = new HashSet<CommPortIdentifier>();
        Enumeration thePorts = CommPortIdentifier.getPortIdentifiers();
        while (thePorts.hasMoreElements()) {
            CommPortIdentifier com = (CommPortIdentifier) thePorts.nextElement();
            switch (com.getPortType()) {
            case CommPortIdentifier.PORT_SERIAL:
                try {
                    CommPort thePort = com.open("CommUtil", 50);
                    thePort.close();
                    h.add(com);
                } catch (PortInUseException e) {
                    System.out.println("Port, "  + com.getName() + ", is in use.");
                } catch (Exception e) {
                    System.err.println("Failed to open port " +  com.getName());
                    e.printStackTrace();
                }
            }
        }
        return h;

Wondering if anyone can show some me pointers and enlightenment.
Thanks so much in advance.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.