Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: Pls Answer...

  1. #1
    Junior Member
    Join Date
    Oct 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Pls Answer...

    I'm using javax.comm package on my m/c. and try to execute the following prob, but it won't giving an error "Caught java.lang.ClassNotFoundException: com.sun.comm.Win32Driver while loading driver com.sun.comm.Win32Driver"

    Here is the prog.
    import java.lang.Enum;
    import java.util.Enumeration;
    import javax.comm.*;
     
    //import javax.print.attribute.standard.MediaSize.Other;
    public class ListPort {
     
     
        public static void main(String args[]) {
            Enumeration port_list = CommPortIdentifier.getPortIdentifiers();
        try {
                while (port_list.hasMoreElements()) {
                    CommPortIdentifier port_id = (CommPortIdentifier) port_list.nextElement();
                    if (port_id.getPortType() == CommPortIdentifier.PORT_SERIAL) {
                        System.out.println("Serial port: " + port_id.getName());
                    } else if (port_id.getPortType() == CommPortIdentifier.PORT_PARALLEL) {
                        System.out.println("Parallel port: " + port_id.getName());
                    } else {
                        System.out.println("Other port: " + port_id.getName());
                    }
                }
            } catch (Exception e) {
                System.out.println("Error : " + e.getMessage());
            }
     
        } // main
    } // class ListPort
    wts wrong with the code or any suggestions ?
    Thanks


  2. #2
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: Pls Answer...

    What IDE do you use? Have you imported it correctly?
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  3. #3
    Junior Member
    Join Date
    Oct 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Pls Answer...

    i'm using Netbean IDE 7.0. I've imported it correctly. After debugging the prog. above, i found that port_list has null items. I've checked my COM port, its working, LPT port is also working...

  4. #4
    Junior Member Rex the king's Avatar
    Join Date
    Oct 2011
    Location
    INDIA
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Pls Answer...

    my netbeans ide doesnt support javax.comm.*;
    absolutely then there must be error sat time .you should use alternative to this one

  5. #5
    Junior Member
    Join Date
    Oct 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Pls Answer...

    Can anybody give the appropriate answer from this forum please?

Similar Threads

  1. What's ur answer?
    By Tanmaysinha in forum The Cafe
    Replies: 6
    Last Post: October 12th, 2011, 06:26 AM
  2. [SOLVED] Answer always false.
    By tyb97 in forum Loops & Control Statements
    Replies: 5
    Last Post: October 7th, 2011, 10:56 AM
  3. Pls answer( urgent)
    By sar in forum Java Theory & Questions
    Replies: 1
    Last Post: September 20th, 2011, 11:28 AM
  4. need answer for these
    By satishbs in forum Java Theory & Questions
    Replies: 2
    Last Post: April 15th, 2011, 01:46 AM
  5. Does anyone have answer of this Assignment??
    By lulzimfazlija in forum Java Theory & Questions
    Replies: 3
    Last Post: January 21st, 2011, 05:02 AM