[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.platform] Re: DLL file placement

Hi All,
I tried to write a serial port connection object to connect to the com
port.
Basically, I modified the javax.comm sample codes. The first thing is I
wrote the codes using notepad, ie. in console mode. The first thing I
noticed is, under windows2000, the installation of javax.comm asked you to
put the win32com.dll into <JDK>/bin, which I found out it didn't work. You
have to put your dll file in windows system directory. Otherwise no com
port will show up when you run your sample serialDemo.
Now my program works well under console mode, but I wanted to do some
debugging under Eclipse, so I imported the sources into Eclipse. I set the
build path to include the comm.jar. Imported the javax.comm.properties and
the win32com.dll file under the source directory. When I run my program, I
got error when I try to scan the com ports. It failed in the
openConnection().
The same program works as for now I export all sources out for testing.
Can you tell me how you setup your Eclipse and where you put your comm.jar
, win32com.dll and javax.comm.properties file.
Thanks,
Wai.
Below is some source codes :
----------------------------
public class SerialConnection {
    private SerialParameters parameters;
    private OutputStream os;
    private InputStream is;
    private CommPortIdentifier portId;
    private SerialPort sPort;
    private boolean open;
    private SerialPortAccess parent;

    public SerialConnection(SerialPortAccess parent
			    ) {
	this.parent = parent;
	this.parameters = parent.getParameters();
	open = false;
	try {
		openConnection();
	} catch (SerialConnectionException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
   }
   public void openConnection() throws SerialConnectionException {

	// Obtain a CommPortIdentifier object for the port you want to open.
// **** This is where is failed.  ****
	try {
		
parent.setPortId(CommPortIdentifier.getPortIdentifier(parameters.getPortName()));
	} catch (NoSuchPortException e) {
	    throw new SerialConnectionException(e.getMessage());
	}
  
Spencer Shepard wrote:

> Our project uses the javax.comm API's with minimal problems.  :)

> Is it not an option to install it in the jre optional packages directory 
> (and the dll in the jrebin directory) so it is available for all java 
> applications including Eclipse?

> Could you provide more details on the exact error and/or problem?

> 	Have fun.
> 		Spence

> wai wrote:
> > Hi,
> > Thanks for your responses.
> > I am not writing any plugins. It is just a plain java program.
> > I tried put the dll file under org.eclipse.swt.win32 but it failed.
> > The -Djava.library.path didn't work either.
> > Any suggestions will be appreciated.
> > Wai
> > 
> > user@xxxxxxxxxxxxxx wrote:
> > 
> > 
> >>Hi,
> > 
> > 
> >>I think you can place such dlls in your plugin under
> > 
> > 
> >>os/win32/x86
> > 
> > 
> >>then the eclipse will find it. Thats for example the way
> >>the org.eclipse.swt.win32 plugin does it.
> > 
> > 
> >>Regards,
> > 
> > 
> >>Oeter
> > 
> > 
> > 
> >>wai wrote:
> >>
> >>>I am trying to use the javax.comm package within Eclipse.
> >>>I need to place a win32com.dll file in windows system directory for the
> >>>Java API to use it. 
> >>>The program ran fine in windows console mode. 
> >>>I run the same programs within Eclipse but the program failed.
> >>>I suspect Eclipse cannot locate the .dll file. 
> >>>Where do you place this kind of files within Eclipse?
> >>>Thanks,
> >>>Wai
> >>>
> > 
> > 
> >