简体   繁体   English

使用javax.comm api用gcj编译的Java。 可能?

[英]Java compiled with gcj using javax.comm api. Possible?

I have a java program that I'm required to compile into a Linux native program using gcj-4.3. 我有一个Java程序,需要使用gcj-4.3编译为Linux本机程序。 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. javax.comm api提供了串行端口访问,但是我不确定如何使已编译的Java程序使用它。

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. 目标盒已安装Java,但是我的编译程序当然不在JRE中运行...所以我不确定我如何链接comm.jar文件或该文件如何找到.properties文件。这个需要。

I wonder if I can just compile the comm.jar allong with my .jar file and link the two object files together. 我想知道是否可以只用我的.jar文件编译comm.jar allong并将两个目标文件链接在一起。 Can my code then reference the classes in comm.jar? 然后我的代码可以引用comm.jar中的类吗?

Thanks in advance for your help! 在此先感谢您的帮助!

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): 我不是GCJ专家,但是我有一些建议(我没有提供语法,这将需要一些我没有执行的探索):

  • first, I think that you'll have to compile comm.jar into a (shared) library, 首先,我认为您必须将comm.jar编译到一个(共享的)库中,
  • 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. 最后,在调用时使用GCJ_PROPERTIES环境变量将属性传递给程序。

The following pointers might be helpful to implement this: 以下指针可能有助于实现此目的:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM