概述
在终端或IDE中运行java读取串口程序时,总是报告如下信息:
[lhwtouch@localhost root]$ java Main
Experimental: JNI_OnLoad called.
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version = RXTX-2.1-7
check_group_uucp(): error testing lock file creation Error details:Permission deniedcheck_lock_status:
No permission to create lock file.
please see: How can I use Lock Files with rxtx? in INSTALL
根据此提示,找到下载的RXTX包中的INSTALL文件后,用UE打开,发现如下信息【部分】:
Linux (only x86, x86_64, ia64 here but more in the ToyBox)
RXTXcomm.jar goes in /jre/lib/ext (under java)
librxtxSerial.so goes in /jre/lib/[machine type] (i386 for instance)
Make sure the user is in group lock or uucp so lockfiles work.
A person is added to group lock or uucp by editing /etc/groups. Distributions
have various tools but this works:
lock:x:54: becomes:
lock:x:53:jarvi,taj
Now jarvi and taj are in group lock.
Also make sure jarvi and taj have read and write permissions on the port.
解决步骤为:
1:查找/etc下的groups文件,但是没有找到。只有group、group- 这2个文件,其中group文件就是我们要找的。
打开此文件,将如下2段修改:
uucp:x:14:uucp 修改为 uucp:x:14:uucp,lhwtouch
lock:x:54: 修改为 lock:x:54:lhwtouch
修改这个文件后,必须重启系统,才能使之起效!
备注:
1、本人所用系统为中标普华linux2.6
2、修改group文件中的lhwtouch为系统的普通用户。
版权声明:本文为博主原创文章,未经博主允许不得转载。
最后
以上就是还单身香水为你收集整理的linux java串口读写权限_解决linux下java读取串口之权限问题 No permission to create lock file. ...的全部内容,希望文章能够帮你解决linux java串口读写权限_解决linux下java读取串口之权限问题 No permission to create lock file. ...所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复