From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Tue Mar 14 23:21:57 2006 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Tue Mar 14 23:21:57 2006 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj@www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj@www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx@linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 14 23:21:57 2006 Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj@www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 14 23:21:57 2006 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj@www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Tue Mar 14 23:21:57 2006 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj@www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx@linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Tue Mar 28 18:25:20 2006 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Tue Mar 28 18:25:20 2006 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj@www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj@www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx@linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 28 18:25:20 2006 Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj@www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 28 18:25:20 2006 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj@www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Tue Mar 28 18:25:20 2006 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj@www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx@linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Tue Mar 28 20:17:16 2006 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Tue Mar 28 20:17:16 2006 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj@www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj@www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx@linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 28 20:17:16 2006 Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj@www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 28 20:17:16 2006 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj@www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Tue Mar 28 20:17:16 2006 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj@www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx@linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx > From jsahn at connectedsys.com Thu Mar 3 09:52:17 2005 From: jsahn at connectedsys.com (Jisung, Ahn) Date: Fri, 04 Mar 2005 01:52:17 +0900 Subject: [Rxtx] Was Rxtx ported on MIPS 32? Message-ID: <422740C1.4070902@connectedsys.com> I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . COMM within J9 is horrible. It miss data!!! Was RXTX ported on MIPS32? Is there MIPS 32 RXTX references? From moritz.gmelin at gmx.de Thu Mar 3 09:57:59 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Thu, 3 Mar 2005 17:57:59 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: Message-ID: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> There has been a previous patch that could do this from within the JAR Archive. Extract the native lib from the JAR, write it to a temporary file and load that file as a library. Could be added to your patch... M. Am 26.02.2005 um 20:11 schrieb Trent Jarvi: > > Anyone have a problem these changes? > > -- > Trent Jarvi > taj at www.linux.org.uk > > ---------- Forwarded message ---------- > Date: Sat, 26 Feb 2005 13:53:17 -0500 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Patch for Libraries on Classpath > > Hi, > > Included is a patch file that allows the libaries (e.g > librxtxSerial.so or rxtxSerial.dll) to be loaded from the classpath > instead of having to be included in java.library.path. > > I am using RXTX for my senior project but didn't have access to > install the libraries so I created this little fix. > > I hope others can find it useful. > > -Chris Gaffney > Grand Valley State University.diff -Naur > rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java 2003-02-18 > 06:51:20.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java 2005-02-26 > 13:35:02.821332008 -0500 > > @@ -80,7 +80,7 @@ > > if (debug) > > System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > } > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > } > > CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver > driver) > > { > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > --- rxtx-2.1-7pre17-orig/src/I2C.java 2002-04-05 12:05:15.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/I2C.java 2005-02-26 13:27:16.929158384 > -0500 > > @@ -35,7 +35,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxI2C" ); > > + LibLoader.loadLibrary( "rxtxI2C" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java 2002-11-25 > 16:57:42.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java 2005-02-26 13:27:55.928229624 > -0500 > > @@ -32,7 +32,7 @@ > > { > > > > static { > > - System.loadLibrary( "rxtxParallel" ); > > + LibLoader.loadLibrary( "rxtxParallel" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java 1969-12-31 > 19:00:00.000000000 -0500 > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java 2005-02-26 > 13:38:38.578531928 -0500 > > @@ -0,0 +1,68 @@ > > +/* > > + * LibLoader.java > > + * > > + * Created on February 26, 2005, 1:03 PM > > + */ > > + > > +package gnu.io; > > + > > +import java.net.URL; > > +import java.util.HashSet; > > +import java.util.Locale; > > +import java.util.Set; > > + > > +/** > > + * Package specific class for allowing the loading of libraries from > the > > + * classpath. This class uses some RXTX specific conventions so it > would require > > + * some modifications for use in other software. > > + * @author Chris Gaffney > > + */ > > +class LibLoader { > > + /** Set of loaded libaries. */ > > + private static final Set loaded = new HashSet(); > > + > > + /** This is a static class so lets not let it be instantiated. */ > > + private LibLoader() {} > > + > > + public static void loadLibrary(String lib) { > > + if(loaded.contains(lib)) { > > + // Library is already loaded so just exit. > > + return; > > + } > > + > > + // Lets try to load the library. > > + try { > > + // Try to load the library through regular channels. > > + System.loadLibrary(lib); > > + } catch (UnsatisfiedLinkError e) { > > + // Load has failed so we attempt to locate the library > > + // on the classpath > > + String fileName = lib + "."; > > + > > + String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > + if(os.equals("windows")) { > > + // Windows. > > + fileName += "dll"; > > + } else { > > + fileName = "lib" + fileName + "so"; > > + } > > + > > + URL libURL = ClassLoader.getSystemResource(fileName); > > + //URL libURL = > getClass().getClassLoader().getResource(fileName); > > + > > + if(libURL == null) { > > + // If we couldn't find it on the classpath so throw > the original > > + // exception. > > + throw e; > > + } else { > > + // File exists so lets load it. If it fails then we > just let the > > + // exception be thrown to the parent class. > > + System.load(libURL.getFile()); > > + } > > + } > > + > > + // If we made it here then everything went well so mark the > library as > > + // loaded. > > + loaded.add(lib); > > + } > > +} > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > --- rxtx-2.1-7pre17-orig/src/RS485.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/RS485.java 2005-02-26 13:28:09.916103144 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRS485" ); > > + LibLoader.loadLibrary( "rxtxRS485" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java 2005-02-26 > 13:28:27.427441016 -0500 > > @@ -41,7 +41,7 @@ > > static > > { > > if(debug ) System.out.println("RXTXCommDriver {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > > > /* > > Perform a crude check to make sure people don't mix > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java 2003-07-17 > 22:20:26.000000000 -0400 > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java 2005-02-26 > 13:28:47.677362560 -0500 > > @@ -51,7 +51,7 @@ > > > > if(debug ) > > z.reportln( "RXTXPort {}"); > > - System.loadLibrary( "rxtxSerial" ); > > + LibLoader.loadLibrary( "rxtxSerial" ); > > Initialize(); > > } > > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > --- rxtx-2.1-7pre17-orig/src/Raw.java 2002-04-05 12:05:16.000000000 > -0500 > > +++ rxtx-2.1-7pre17-mod/src/Raw.java 2005-02-26 13:29:05.616635376 > -0500 > > @@ -32,7 +32,7 @@ > > > > static > > { > > - System.loadLibrary( "rxtxRaw" ); > > + LibLoader.loadLibrary( "rxtxRaw" ); > > Initialize(); > > } > > > > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx From taj at www.linux.org.uk Thu Mar 3 12:32:44 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 19:32:44 +0000 (GMT) Subject: [Rxtx] Was Rxtx ported on MIPS 32? In-Reply-To: <422740C1.4070902@connectedsys.com> References: <422740C1.4070902@connectedsys.com> Message-ID: On Fri, 4 Mar 2005, Jisung, Ahn wrote: > I use MIPS 32, Linux 2.4 and J9(v 2.0) on my company . > > COMM within J9 is horrible. It miss data!!! > > Was RXTX ported on MIPS32? > > Is there MIPS 32 RXTX references? > I'm sure this can work but how do you normally build C programs for your MIPS system? Is the compiler on the mips machine or do you cross compile? I have a openwrt wireless box with mips that uses a cross tool chain because it really does not have the space for anything. Is this what you do too? There are many linux systems like this that can work but just need tinkering to build. MIPS, ARM, ... If you are trying to build on the system, email me a typescript of the configure and make output off the list and I can then fix any problems with he build. It may even just work though I suspect I need to see that configure output to see how J9 reports itself. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Mar 3 14:57:08 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 3 Mar 2005 21:57:08 +0000 (GMT) Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: On Thu, 3 Mar 2005, Moritz Gmelin wrote: > There has been a previous patch that could do this from within the JAR > Archive. > > Extract the native lib from the JAR, write it to a temporary file and > load that file as a library. > > Could be added to your patch... > > > M. > I had looked at the thread and thought there was a problem with making it work for some reason. I've now forgotten why. I'll look at it again. Did you get it to work on the various OS's? -- Trent Jarvi taj at www.linux.org.uk From moritz.gmelin at gmx.de Fri Mar 4 07:40:32 2005 From: moritz.gmelin at gmx.de (Moritz Gmelin) Date: Fri, 4 Mar 2005 15:40:32 +0100 Subject: [Rxtx] RXTX Patch for Libraries on Classpath (fwd) In-Reply-To: References: <2ee20fa4c5d091a444feea52dd58e784@gmx.de> Message-ID: <7665d10763379c0efd3b7c1149574e4b@gmx.de> It works with Linux, MacOS X, Windows and PocketPC. On Windows it'll leave the file after exiting the system which can cause a lot of garbage. M. Am 03.03.2005 um 22:57 schrieb Trent Jarvi: > On Thu, 3 Mar 2005, Moritz Gmelin wrote: > >> There has been a previous patch that could do this from within the JAR >> Archive. >> >> Extract the native lib from the JAR, write it to a temporary file and >> load that file as a library. >> >> Could be added to your patch... >> >> >> M. >> > > I had looked at the thread and thought there was a problem with making > it > work for some reason. I've now forgotten why. > > I'll look at it again. Did you get it to work on the various OS's? > > -- > Trent Jarvi > taj at www.linux.org.uk > _______________________________________________ > Rxtx mailing list > Rxtx at linuxgrrls.org > http://mailman.linuxgrrls.org/mailman/listinfo/rxtx >