We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Order of linked jars
Page Index Toggle Pages: 1
Order of linked jars? (Read 275 times)
Order of linked jars?
Jan 19th, 2009, 8:22pm
 
Hi there,

I'm running a larger Java app with a Processing front end.  Running the non-GUI component from within Eclipse or the command line with explicit jar linking (of several 3rd party libraries) works quite well, but when I run from within the Processing IDE with the jars in the /code folder, something goes awry.

More specifically, I'm trying to access the serial ports and using components of comm.jar, modified slightly from the one that ships with Java 1.6.  Although I get data quite nicely without the GUI, the comm ports appear to be inaccessible to me except through the built-in Processing library when I'm running from the Processing IDE.  

How can I fix this?  Can I manually override any of the native libraries in Processing?  Is there some explicit ordering of jars that I can apply to ensure my comm port stuff is linked preferentially?

Thanks,

Aaron Genest
Department of Computer Science
University of Saskatchewan
Re: Order of linked jars?
Reply #1 - Jan 19th, 2009, 10:07pm
 
Mixing libraries with same classes but different versions is in general a bad idea... Unless you use some specific classloader or something (don't me ask how!)
I can be wrong but I think from from previous bad experience, that Java uses the first class it finds. At least when using java.ext.dirs. I don't know if classpath order is respected.

Anyway, the best way to deal with that is to remove the old library and use only the newest.
Re: Order of linked jars?
Reply #2 - Jan 19th, 2009, 10:27pm
 
Thanks, I've done that, but it appears that the communication library in Processing is over-riding the Sun's java library of java.comm.*  

Has anyone else found this?
Re: Order of linked jars?
Reply #3 - Jan 19th, 2009, 10:49pm
 
Ah. This kind of conflict...
Did you tried to use fully qualified names?
java.comm.SomeClass sc = new java.comm.SomeClass();
Page Index Toggle Pages: 1