I'm using the javax.comm on XP with sun's NetBeans IDE 3.6. I've found a lot of help on setting up the javax.comm correctly. My program works and will find my ports correctly if I run it from the IDE. However, I've moved the files into a jar and now it won't find any ports. Also, If I move the jar to another computer (that can run jars) it seems like the program just dies. Javaw is running under the task list but no windows open. I'm not that comfortable with jar files yet, but I have several others I tested out on the both computers. I don't receive any errors in the IDE when compiling or executing. Anyone else have this happen? code below. Thanks.
my jar contains: XportMonitor portWatch javax.comm.properties[tried without] javax.comm.jar[tried without] win32com.dll[tried without]
this is only a modified version of the simple read that comes with the api.
Don't the properties file and .dll need to be in a specific location on the disk, rather than in the JAR, in order for it to run?
SCJP 1.4, www.gsi3d.org.uk
posted 15 years ago
in the ide yes- I had to put them in specific locations. The jar would run in my IDE even if I only had the two class files in the jar. But it wouldn't find any ports. if your familiar with netbeans - I made my jar execution path the same as my external execution path too - that didnt work either.
Q: BlackBox gives me a message that says "No serial ports found!"
A: In order for the Java communications API to find ports the file javax.comm.properties must be in the correct place. The preferred location is in <jdk>/lib. See the installation instructions for alternate locations and further information.
Since it works in NetBeans, it may be that you are running a one VM inside the IDE and a different version on the outside.
In order for the Java communications API to find ports the file javax.comm.properties must be in the correct place. The preferred location is in <jdk>/lib
The program works and finds ports in the IDE. When run from a jar inside or out of the IDE it doesn't.
I'll try to add the api jar to my jar after unzipping it and see what happens. Thanks a lot for the help.
posted 15 years ago
combining the javax.comm jar with my jar didn't solve my problem.... however I did figure out how to do it with help from a Mr. Brogen...
I think there are three possible reasons - which I'm sure you have already considered, but anyway: 1. the comm.jar is not being found 2. the DLL isn't being found and loaded 3. the comm.properties file is not being found
Since 1 & 2 would produce error message, I'm betting on 3 - It is my understanding that javax.comm.properties has to be located by the JVM at the ../lib directory relative to the /bin directory where javaw starts from. This has nothing to do with where your jar file lives.
(Thats one reason I prefer to stay away from IDEs - they do things behind your back and don't tell you about them.)