Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

'Error instantiating class com.sun.comm.Win32Driver' for javax.comm

807591Mar 5 2008
Here is what I have done:

1. create a new project in Eclipse

2. copied the following from http://www.cafeaulait.org/books/javaio/ioexamples/17/PortLister.java in the new project
import javax.comm.*;
import java.util.*;
public class PortLister {
public static void main(String[] args) {
Enumeration e = CommPortIdentifier.getPortIdentifiers();
while (e.hasMoreElements()) {
System.out.println((CommPortIdentifier) e.nextElement());
}
}
}
it did not compile because of no javax.com package

3. download comm.jar and add to build path so it now compiles.
execute it, but got error:
javax.comm: Can't find javax.comm.properties!

5. add javax.comm.properties to the project
execute it, but got error:
java.io.IOException: Error instantiating class com.sun.comm.Win32Driver
at javax.comm.CommPortIdentifier.loadDriver(CommPortIdentifier.java:239)
at javax.comm.CommPortIdentifier.<clinit>(CommPortIdentifier.java:109)
at PortLister.main(PortLister.java:6)

6. add win32com.dll to all directories mentioned by different opinions I googled, including %java_home%/bin, %java_home%/jre/bin, %windor/system32, still get the same error.

What do I miss here? Appreciate any suggestion.

thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 2 2008
Added on Mar 5 2008
0 comments
406 views