Java compiled with gcj using javax.comm api. Possible?

318 views Asked by At

I have a java program that I'm required to compile into a Linux native program using gcj-4.3. This program requires serial port access. The javax.comm api provides serial port access but I'm not sure how to get my compiled java program to use it.

The target box has Java installed, but of course my compiled program isn't running in the JRE...so I'm not exactly sure how I can link in the comm.jar file or how that file can find the .properties file it requires.

I wonder if I can just compile the comm.jar allong with my .jar file and link the two object files together. Can my code then reference the classes in comm.jar?

Thanks in advance for your help!

1

There are 1 answers

0
Pascal Thivent On

I'm not an GCJ expert but I have some suggestions (I'm not providing the syntax, this will require some exploration that I didn't perform):

  • first, I think that you'll have to compile comm.jar into a (shared) library,
  • then, you'll have to link your code against the library,
  • finally, use the GCJ_PROPERTIES environment variable to pass properties to the program at invocation time.

The following pointers might be helpful to implement this: