How to open the comm ports?

Hi,
im using javacomm to detect my comm ports.i have two serial
and a parallel port (com1,com2 and LPT1) but it found no ports and throws
as follows,
found: javax.comm.CommPortEnumerator@e83912
found: 0 open ports
i placed .properties file in ..\jdk1.5.0\jre\lib
comm jar file in ..\jdk1.5.0\jre\lib\ext
and WIN32COM.DLL in ..jre\bin
am i doing right?
Here is the code,
import javax.comm.CommPortIdentifier;
import javax.comm.SerialPort;
import javax.comm.PortInUseException;
import java.util.Enumeration;
import java.util.Vector;
public class TestEnumeration {
public static void main(String args[]) {
Vector portslist = TestEnumeration.getAvailableSerialPorts();
System.out.println("found: "+portslist.size()+" open ports");
public static Vector getAvailableSerialPorts() {
CommPortIdentifier pId=null;
SerialPort sPort=null;
Enumeration pList=null;
boolean foundport=false;
pList = CommPortIdentifier.getPortIdentifiers();
String port=null;
Vector ports=new Vector();
if(!pList.hasMoreElements()) {
System.out.println("found: "+pList);
return ports;
while (pList.hasMoreElements()) {
pId = (CommPortIdentifier) pList.nextElement();
if (pId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
foundport=true;
try {
sPort = (SerialPort)pId.open("serialport", 1000);
} catch (PortInUseException e) {
foundport=false;
System.out.println(pId.getName()+ " is closed");
} finally {
if(sPort!=null) {
try { sPort.close(); } catch(Exception e) {}
if(foundport) {
ports.add(pId.getName());
System.out.println(pId.getName()+ " is open");
return ports;
please help me on how to open the comm ports..

Try this, It workd for me. Before doing this make sure you have serial ports on you r computer by following these steps:
open "regedit"
go to "HKEY_LOCAL_MACHINE" > HARDWARE > DEVICEMAP
and check if there is any serial ports. If htere is any, then use following program to enumerate throught the ports:
class SimpleRead() {
portList = CommPortIdentifier.getPortIdentifiers();
     while (portList.hasMoreElements()) {
     portId = (CommPortIdentifier) portList.nextElement();
     if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
          if (portId.getName().equals(defaultPort)) {
          System.out.println("Found port: "+defaultPort);
          portFound = true;
          SimpleRead reader = new SimpleRead();
     if (!portFound) {
     System.out.println("port " + defaultPort + " not found.");
}

Similar Messages

  • How to open the proper port for your xbox 360 on a NVG589 router for optimal online gaming

    This took me a while to figure out on my own, so hopefully this will save someone else the trouble. My Xbox 360 said my setting were moderate.  Step 1: In your internet browser, type this http://192.168.1.254 into your address bar Step 2: Click on the tab at the top that says Firewall  Step 3: Click on the sub tab that says NAT/Gaming Step 4: In the drop down box located under the heading "Application Hosting Entry" Scroll down the option that says "XBox Live 360" and select it Step 5: In the second drop down box under the same heading find your Xbox 360's ip address and select it. If you don't know you Xbox's ip address it can be found on your console Network settings, select your connection, then select configure network, under basic setting will your ip address, remember that,  Step 6: Click Add  Step 7: Restart Xbox, everything should be running smoothly online Step 8: Profit! 

    Hello, carrlouie87!
    Thanks for posting. I know quite a few users will find your post helpful, and I hope we continue to see you around on the forums!
    As always, let us know if you have any questions or concerns!
    -Mariana

  • How do I open the same ports on an Airport Extreme Base Station for multiple computers at the same time?

    As the title suggests...
    I have a mix of five Mac and PC's at home using an Airport Extreme Base Station as the router.   I need many ports opened on the AEBS for all of the computers- not just one computer.  (for example: three people want to play TF2 on Steam at the same time; each machine needs the correct ports open on the router).   Port forwarding  only allows me to forward a given port to a single IP, yet I need that port open for five differnt IP's, all at the same time. 
    How do I do that on an AEBS?
    In the same way, I have a small office of four iMacs using an old airport with the same exact issue.   I would like to be able to connect to all of them remotely with Apple Remote Desktop, but the port forwarding on the airport only allows a port to forward to a single IP.   I want to be able to tunnel into the office network and log onto any machine behind the Airport extreme... not just a single IP.    I currently have it set up where I can tunnel into the office from my house, I can find the one machine that the port forwarding has been assigned to, I can log on and everything is just fine... with one machine.    How do I open the firewall for the other machines? 
    TL,DR version:  How do you open ports on an Airport Extreme Base Station instead of forwarding ports?   Forwarding ports doesn't work for multiple IP's.  

    You can open a single or multiple ports to a single device or different ports to different devices, but you cannot open the same port to multiple devices via the AirPort Utility for the Apple routers.

  • Could any one help how to open the application without port number in servl

    Could any one help how to open the application without port number in servlets or jsp?

    Well, configure the application server/web container to listen to the default http port of 80, rather than 8080.
    I couldnt get where to specify 80 instead of 8080 so that it opens without numbers

  • Apple's Firewall opens the wrong ports!

    This is a follow up question to a problem posted in another forum here. There are a couple of screenshots in the last post that illustrate the problem.
    In System Preferences > Sharing > Firewall, checking Apple Remote Desktop opens TCP and UDP ports 3238. The problem is that Apple Remote Desktop needs ports 3283 (not 3238 - note the last two digits are transposed) and 5900. I've already worked around this issue by creating a new firewall entry that opens the correct ports, but I'd really like to get my Sharing Preferences corrected. Plus it bothers me that I can't block port 3238 by unchecking Apple Remote Desktop since that will prevent ARD from working, even though it opens the wrong ports.
    This isn't really an Apple Remote Desktop problem, it's something wrong with the firewall in this system's version of OS X. Any idea how I can fix it, other than the ugly workaround I'm using, and short of reinstalling OS X?

    Editing the .plist file is easy with xcode's Property List Editor, which I just installed. However, before I did that I simply copied a "correct" /Library/Preferences/com.apple.sharing.firewall.plist file from another computer. That was even easier

  • How to close the COM Port ??????????

    Dear all :
    I have written an application that send AT commands to a modem , Once I opened a com port , i don't know how to close it . I got the null pointer exception when i create a new channel , because the inputStream and outputStream is owned by the previous channel . So , some one can teach me how to close the com port that opened before ?
    my source code for open port :
    public void Connect_Com(CommPortIdentifier portId) {
    Integer i = new Integer((int) (Math.random()* 1000));
    String channel = "channel" + i.toString();
    System.out.println(channel);
    try {
    System.out.println("preparing to open port");
    serialPort = (SerialPort) portId.open(channel, 2000);
    } catch (PortInUseException e) {}
    try {
    inputStream = serialPort.getInputStream();
    System.out.println("getting inputStream");
              } catch (IOException e) {}
    try {
    serialPort.addEventListener(this);
              } catch (TooManyListenersException e) {}
    serialPort.notifyOnDataAvailable(true);
    try {
    serialPort.setSerialPortParams(9600,
    SerialPort.DATABITS_8,
    SerialPort.STOPBITS_1,
    SerialPort.PARITY_NONE);
    } catch (UnsupportedCommOperationException e) {}

    serialPort.close() ?
    From the documentation of SerialPort:
    - SerialPort extends CommPort.
    - CommPort.close() closes the communications port.

  • How to change the default port of webdispatcher

    Hello Everyone,
    We wish to  know to how to change the default port of SAP webpatcher port from 81$$ to 80.
    Appreciate your response.
    Thanks,
    Vadi

    Hello Vadi
    you have to change the PORT value in your profile parameter from 81$$ to 80
    icm/server_port_0 = PROT=HTTP,PORT=81$$ to
    icm/server_port_0 = PROT=HTTP,PORT=80
    Also, in SMICM, then change http service port and activate it and above parameter will require SAP restart
    $$ is used generally to accomodate multiple port services running in SMICM and so as to avoid the parameter setting according to instance number of any system.
    thanks
    Bhudev

  • HT4796 I have made a file using the Pages app.I mailed it to a friend.When she tried opening the same file on her pc at home , It did not open.Please help me as to how to open the file in the Microsoft word format on her pc.

    I have made a file using the Pages app.I mailed it to a friend.When she tried opening the same file on her pc at home , It did not open.Please help me as to how to open the file in the Microsoft word format on her pc.

    Send it as a PDF.

  • Hi  can any body please tell me how to open the .exe files in mac and why it is not supported with unarchiever app , also i am not able to run and dvd's in my mac its not accepting any cd's or dvd'd why do i need to do some settings for it ?

    Hi  can any body please tell me how to open the .exe files in mac and why it is not supported with unarchiever app , also i am not able to run and dvd's in my mac its not accepting any cd's or dvd'd why? do i need to do some pre defined  settings to run the cd's and dvd's ?

    A .exe file is a Windows executable. OS X does not run Windows programs. If you need to use .exe files then you will need to install Windows on your Mac:
    Windows on Intel Macs
    There are presently several alternatives for running Windows on Intel Macs.
    Install the Apple Boot Camp software.  Purchase Windows XP w/Service Pak2, Vista, or Windows 7.  Follow instructions in the Boot Camp documentation on installation of Boot Camp, creating Driver CD, and installing Windows.  Boot Camp enables you to boot the computer into OS X or Windows.
    Parallels Desktop for Mac and Windows XP, Vista Business, Vista Ultimate, or Windows 7.  Parallels is software virtualization that enables running Windows concurrently with OS X.
    VM Fusionand Windows XP, Vista Business, Vista Ultimate, or Windows 7.  VM Fusion is software virtualization that enables running Windows concurrently with OS X.
    CrossOver which enables running many Windows applications without having to install Windows.  The Windows applications can run concurrently with OS X.
    VirtualBox is a new Open Source freeware virtual machine such as VM Fusion and Parallels that was developed by Solaris.  It is not as fully developed for the Mac as Parallels and VM Fusion.
    Note that Parallels and VM Fusion can also run other operating systems such as Linux, Unix, OS/2, Solaris, etc.  There are performance differences between dual-boot systems and virtualization.  The latter tend to be a little slower (not much) and do not provide the video performance of the dual-boot system. See MacTech.com's Virtualization Benchmarking for comparisons of Boot Camp, Parallels, and VM Fusion. Boot Camp is only available with Leopard or Snow Leopard. Except for Crossover and a couple of similar alternatives like DarWine you must have a valid installer disc for Windows.
    You must also have an internal optical drive for installing Windows. Windows cannot be installed from an external optical drive.

  • How to open the file types of iOSApp(ipa),EPUBFile(.epub) in windows 7(32 bit)

    How to open the file types of iOSAPP(ipa),EPUBfile(.epub) in windows 7(32 bit)

    iOS apps can be added to an iTunes library and thereafter transferred to an iOS device. They cannot be opened directly on a PC.
    epub files can be added to an iTunes library, and thereafter transferred to an iOS device where they can be read with the iBooks application. Files protected with Apple's DRM cannot be opened directly on a PC, though there are programs such as Kindle and Calibre that will open non-protected epub files.
    tt2

  • How to open the crystal reports 2008 in CRYSTAL REPORTS ENTERPRISE 4.0

    Hi All,
    Can you please let me know how can migrated the crystal reports from BO XI 3.1 to SAP BO 4.1 and after migrate how to open the crystal reports 2008 in CRYSTAL REPORTS ENTERPRISE 4.0.
    can you please help on this and if document please share.
    Thanks,
    Rajesh

    Use the upgrade management tool to move from 3.1 reports to BO 4.1. After migration, open the report in crystal enterprise 4.0, you will get a message saying that the report will be converted to latest version, will not be able to view from older version after converting. (Similar words- not sure exact words).

  • How to open the Url type in Attachments Table

    Hi All,
    If we attached the any files, files are stored in the fnd_lobs table, pickup the data from the fnd lobs table and stored in the local system but if attached the url type how to open the url type.is there any standard ?
    Thanks,
    Venkat

    You can do it one of two ways:
    1. Insert some CSS that will change the target to "_new".
    2. Change the field that the user enters information in to a single line of text, then create a calculated column that is:
    =CONCATENATE("<a href=",[URL Field]." target=new>Click here</a>")
    Format that as a number.
    Andy Wessendorf SharePoint Developer II | Rackspace [email protected]

  • How to open the Data Perspective function of Smart View in EAS?

    How to open the Data Perspective function of Smart View in EAS?
    I use my Smart View to connect one ASO cube, and I found the button of Data Perspective is grey. It's not available.
    In Smart View Users' Guide, it says:
    Note: Data perspective may not be enabled in your Smart View system. Your options for data perspective are enabled and configured by the administrator in Oracle Essbase Administration Services.
    But I could not find how to configure the this option in EAS.
    Does anyone know about this?

    I have already turned on the varying attributes function, but the data perspective button is still grey, not available.

  • How to open the second VM in Oracle 11gR2 2-nodes RAC system ?

    Folks,
    Hello. I have been installing Oracle Database 11gR2 RAC system using 2 nodes that are 2 Virtual Machines (rac1 and rac2) on the top of VMPLayer 3.
    I follow the tutorial http://appsdbaworkshop.blogspot.com/2011/10/11gr2-rac-on-linux-56-using-vmware.html to do.
    The original Virtual Machine rac1 has run correctly. I configure rac1 network (eth0 and eth1) by opening VM rac1 and using command "[root@rac1\] #neat" as root user to invoke the network configuration.
    For the second Virtual Machine rac2, I simply copy all files in "C:\VM\rac1" into "C:\VM\rac2". Then I have done the following:
    1) In the directory "C:\VM\rac2", rename "rac1.vmx" to "rac2.vmx".
    2) Change display name from "rac1" to "rac2" in the file "rac2.vmx".
    The next thing to do for rac2 is to open the Virtual Machine rac2 and configure its network (eth0 and eth1) by using the command "[root@rac2\]#neat" as root user.
    But by this step, I don't understand how to open the Virtual Machine rac2 so that can configure its network (eth0 and eth1).
    Can any folk tell me how to open the VM rac2 to configure its network by this step ?

    Hi,
    But by this step, I don't understand how to open the Virtual Machine rac2 so that can configure its network (eth0 and eth1)."rac2" is a new virtual machine after you copied and changed the display name and you need to add this in the vmware enventory (I am talking about vmware server and vmware player should have the same way as it is supposed to run multiple vritual machines on your PC). Then it will be visible it to you. Now start this new machine and edit the network configuration.
    Salman

  • How to open the body of nokia N72

    It seems that some moisture has entered my Nokia N72 since last 10 hours the screen appears grey and there is a display problem. Can any one help me by showing me how to open the body of Nokia N72 by step by step description or diagrammatically?

    Sorry but it is against the rules of this forum to discuss warranty voiding procedures like disassembly, regardless of your personal warranty status.
    Try one of the many unofficial forums, that you can find by searching google, for help. 

Maybe you are looking for