Friday, November 19, 2004

Java Communications API and Eclipse

Has anyone gotten the Java Communications API to work with Eclipse? I'm trying to develop some Java code to work over either the serial port or the parallel port, but Eclipse refuses to recognize the libraries.

For instance, I can open the type CommPortEnumerator but not compile - the import statement has the following error message:
The imported type javax.comm.CommPortEnumerator is not visible

I do have my system setup correctly. I can go to the command-line and compile and then execute code that sees the API fine. Eclipse just refuses to recognize it.

I posted this at the Eclipse.org newsgroups. Hopefully someone will point out what I'm missing.

UPDATE: The light finally came on when I realized that I was using two differenct classes - one that was package scoped in Eclipse and the other was a public class. Damn, I hate it when I miss something like that!!

For future reference on installing the Java Communications API, here's what I've determined for placement of files in relation to a JRE:
1. <JRE>\bin\win32com.dll
2. <JRE>\lib\javax.comm.properties
3. <JRE>\lib\ext\comm.jar

Where JRE is one of:
a. C:\j2sdk1.4.2_06\jre
b. C:\Program Files\Java\j2re1.4.2_06

No comments: