javax的java替代位置。Windows中的comm.properties
我正在构建一个需要安装在Windows计算机上的程序,对于这些计算机,我没有对%JAVA\u HOME%/lib的写入权限
还有其他地方可以移动javax吗。是否将comm.properties指向%JAVA\u HOME%/lib以外的其他对象
根据Java COM API常见问题解答:
Q: My application does not find any ports when it enumerates available ports.
A: In order for the Java communications API to find ports the file javax.comm.properties must be in the correct place. The preferred location is in /lib. See the installation instructions for alternate locations and further information.
在哪里可以找到包含这些备用位置的Sun安装说明
# 1 楼答案
我找到了一种适合我的方法。以下是要求:
comm.jar
必须精确命名为comm.jar
(例如,不是comm-2.0.jar
),并且必须位于名为"lib"
的目录中的类路径中李>javax.comm.properties
也必须具有该确切名称,并且位于与comm.jar
相同的目录中李>win32com.dll
必须在java.library.path
中引用李>因此,如果您有如下目录设置:
然后,您可以在这些目录的根目录中使用以下
java
命令(假设项目的jar
文件和YourMainClass
也在lib
目录中:这样,您就不再需要在JRE的
\bin
或\lib
目录下放置任何内容# 2 楼答案
根据一个家伙说的话: https://forums.oracle.com/forums/thread.jspa?threadID=1316406
您可以将文件放入javax。comm.properties您放置comm.jar的位置。但要运行该程序,您应该指定指向comm.jar的路径,如下所示:
希望有帮助