Problem using javax.comm

Hi all,

I’m working on a plugin wich uses the javax.comm library package. It is used to communicate with an serial com-port on a windows xp system.
When i make a class in eclipse, it is no problem to run it and communicate with my port.
But now i want to make the plugin, i’ve made an extra class wich communicates with the com-port. But it looks like somehow it cannot read the ports.

I use: CommPortIdentifier.getPortIdentifiers() to retrieve a portlist.

in the ‘standalone’ class i get a list of available ports and i can get the names etc. but in the plugin it doesn’t return any ports at all.
I’ve checked the path settings they are correctly set.
but the classpath differs. in the normal programm it is:

c:\Java\workspace\comapp

and in Servoy it is:

servoy_developer.jar

But i’m not sure that has anything to do with it. Does anybody have any experience with this?

javax is named after java extension (many of the javax libs are not default shipped with a Java install) so likly you do not have the lib in servoy, in a plugin you can use an lib see for example the scheduler plugin (sources are in the jar)

I’ve installed the library in the jre/lib directory. And its found by servoy i believe, because it does not give any errors. I believe it just does not read the properties file..
Any ideas? or am i doing it completely wrong?

Greetz

jre/lib directory will not work, servoy smart clients likly need to be able to load the classes as well.
Checkout the scheduler.jar.jnlp, scheduler.jar and scheduler sub dir in Servoy plugins dir.

OK now i’ve removed the jar, dll and .properties files from the jre and placed them in the servoy/plugin/myplugin directory.
made an .jnlp file wich should make them available. but now i get errors.. it seems that the library does not load anymore.. :S

I’m a little confused where to place the needed dll and .properties file. If i place them in the myplugin directory i dont think it reads them.. does it?

you can not load a .dll file just like that. Search on it on the web and you will find your pointers. You need to pack them in a jar.

For .dll usage checkout the jnlp specification from Sun

hmm.. i think i’ve done everything i should do.. packed the dll in a jar.
made an windows os resource in the jnlp file etc. but still it does not load properly..

i’ve found this url and halfway down (Q: How can I use Web Start and Comm API together?) somebody else tried the same and did not succeed.. maybe it is not possible at all?

looks like it… But they give you alternatives…

Allright, i’ve come a little further..
When using the developer it never works.. what ever i do.
But when starting the client, it does run!! I’m not sure what’s happening now.. but i’ve got something going now. Is there anybody who can explain this?

The jnlp file looks like this:

<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+"
      codebase="%%serverURL%%"
      href="/servoy-client/plugins/DigiPosPlugin.jar.jnlp">
   <information> 
      <title>Servoy Client Plugins</title> 
      <vendor>Servoy and Others</vendor>
      <offline-allowed/>
   </information>
   <resources>
   	  <jar href="/plugins/DigiPosPlugin.jar" download="eager" part="scheduler" version="%%version%%"/>
      <jar href="/plugins/DigiPosPlugin/comm.jar" download="%%loadmethod%%" part="comm" version="1.0"/>
      <package name="javax.comm.*" part="comm" recursive="true"/>   
   </resources>
   <component-desc/>
</jnlp>

I placed the win32comm.dll in the same directory as the comm.jar. The .properties file is packed in the ‘root’ of DigiPosPlugin.jar

With the developer you probably need to load the dll directly into the classpath when initializing your plugin…

Hello DeRRudi,
me too want to use serial port from servoy it’s possible to have your plug-in to use it.

because i don’t know enougth java to write plug-in.

thank for your help.