Re: Serial Port problem

From: nik[no-spam]cross (_at_wet-wired.com)
Date: 09/03/04


Date: Fri, 03 Sep 2004 17:39:53 +0100


<- Chameleon -> wrote:

>>>>>Enumeration portList = CommPortIdentifier.getPortIdentifiers();
>>>>>
>>>>>this command returns an empty Enumeration. Why?
>>>>>
>>>>>My system is PC with WinXP.
>>>>>I have 1 parallel and 2 serial ports
>>>>>
>>>>>
>>>>
>>>>As a first thought, have you initialized the comm driver.
>>>>I forgot and couldn't see any ports until I used this:
>>>>
>>>> String driverName = "com.sun.comm.Win32Driver";
>>>> try{
>>>> CommDriver commdriver =
>>>>(CommDriver)Class.forName(driverName).newInstance();
>>>> commdriver.initialize();
>>>> }
>>>> catch (Exception e2)
>>>> {
>>>> e2.printStackTrace();
>>>> }
>>>>
>>>>If this doesn't help maybe you could post your code.
>>>
>>>
>>>I have javax.comm.properties file inside <java dir>\lib directory and
>
> this
>
>>>file have this line inside:
>>>-------------
>>>Driver=com.sun.comm.Win32Driver
>>>-------------
>>>Your code works and thankyou, but why I must load dynamically this
>
> driver?
>
>>>If I want to run this code in Linux or other platform?
>>>
>>>Thanks again!
>>>
>>>
>>
>>If that works my first thought would be that you do not have your java
>>lib path set up correctly. What environment/IDE are you developing in?
>>Do you have multiple JREs installed and if so have you installed the
>>Java comm api in the one ypu are running?
>
>
> I have 3 JRE in my machine.
> 1 with Borland J Builder
> 1 the original from Sun
> 1 with Mathematica
>
> I have installed comm in both Borland J Builder and Sun's stand-alone
>
>
After a quick google I found this:

What you have to do is to copy
1) win32com.dll to directory : JBuilder3/bin
2) javax.comm.properties to directory : JBuilder3/jre/lib
3) comm.jar to directory : JBuilder3/lib

http://forum.java.sun.com/thread.jsp?thread=14251&forum=8&message=35130

I hope this helps.



Relevant Pages

  • Re: Serial Port problem
    ... >> If I want to run this code in Linux or other platform? ... > Java comm api in the one ypu are running? ... I have installed comm in both Borland J Builder and Sun's stand-alone ...
    (comp.lang.java.programmer)
  • Re: java gui
    ... there is one in netbeans but it isn't exactly ... like V C++ or Borland C++ builder, after all this is Java and it just aint ...
    (comp.lang.java.gui)
  • Re: Borland Interim CEO Outlines Strategy
    ... tools outside the IDE can be carried to competing IDEs. ... If Borland can tap into 10% of it, ... There's a case where the author basically insulted all Delphi users, and I didn't read a peep about it in the newsgroup. ... It was mentioned that the Java community chose their tool, ...
    (borland.public.delphi.non-technical)
  • Re: Why .NET vs. Win32?
    ... >> is being portrayed as a toolkit, and I can select from a lot of those ... their customers. ... .NET was created out of Java jealousy. ... Borland Patent payoff was a one time event. ...
    (borland.public.delphi.non-technical)
  • Re: .Net is more memory safe?
    ... It is _as_ true as the same claim for Java. ... The .Net memory management or Java management isnt generally the reason for leaks. ... number of developers are many, the complexity of the project is big, and the experience level of each developer ... I really think you should close the eye you normally use to read the newsposts and Borland newsletters with, ...
    (borland.public.delphi.non-technical)