当前位置: 首页 > news >正文

企业网络管理 网站开发与运营室内设计公司排行

企业网络管理 网站开发与运营,室内设计公司排行,柬埔寨网赌网站开发,广东省广州市佛山市简介Jnotiy, 支持动态监控(支持级联监控)文件夹和文件的jar包。在linux中#xff0c;调用linux底层的jnotify服务。在windows中#xff0c;需要添加附件的dll文件。因为通用的Maven仓库中没有此Jar文件#xff0c;pom.xml文件需要如下配置#xff1a;net.contentobjects.jn…简介Jnotiy, 支持动态监控(支持级联监控)文件夹和文件的jar包。在linux中调用linux底层的jnotify服务。在windows中需要添加附件的dll文件。因为通用的Maven仓库中没有此Jar文件pom.xml文件需要如下配置net.contentobjects.jnotifyjnotify0.94bintrayhttp://dl.bintray.com/typesafe/maven-releases/View Code使用首先从jar包中解目录压出dll文件,并放到工程lib/目录下。比如/project/lib/native_libraries/...测试代码import java.lang.reflect.Field;import java.util.Arrays;import java.util.Properties;import org.apache.log4j.Logger;import net.contentobjects.jnotify.JNotify;import net.contentobjects.jnotify.JNotifyException;import net.contentobjects.jnotify.JNotifyListener;public class TestJnotify {static Logger log Logger.getLogger(TestJnotify.class);/*** jnotify动态库 - 32位*/static final String NATIVE_LIBRARIES_32BIT /lib/native_libraries/32bits/;/*** jnotify动态库 - 64位*/static final String NATIVE_LIBRARIES_64BIT /lib/native_libraries/64bits/;public static void main(String[] args) throws JNotifyException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {log.debug(-----------Jnotify test ---------);Properties sysProps System.getProperties();String osArch (String) sysProps.get(os.arch);String osName (String) sysProps.get(os.name);String userDir (String) sysProps.getProperty(user.dir);LOG.debug(os.arch: osArch);LOG.debug(os.name: osName);LOG.debug(userDir: userDir);LOG.debug(java.class.path: sysProps.get(java.class.path));// 直接调用Jnotify时 会发生异常java.lang.UnsatisfiedLinkError: no jnotify_64bit in java.library.path// 这是由于Jnotify使用JNI技术来加载dll文件如果在类路径下没有发现相应的文件就会抛出此异常。// 因此可以通过指定程序的启动参数: java -Djava.library.path/path/to/dll// 或者是通过修改JVM运行时的系统变量的方式来指定dll文件的路径如下// 判断系统是32bit还是64bit决定调用对应的dll文件String jnotifyDir NATIVE_LIBRARIES_64BIT;if (!osArch.contains(64)) {jnotifyDir NATIVE_LIBRARIES_32BIT;}LOG.debug(jnotifyDir: jnotifyDir);// 获取目录路径String pathToAdd userDir jnotifyDir ;boolean isAdded false;final Field usrPathsField ClassLoader.class.getDeclaredField(usr_paths);usrPathsField.setAccessible(true);final String[] paths (String[]) usrPathsField.get(null);LOG.debug(usr_paths: Arrays.toString(paths));for (String path : paths) {if (path.equals(pathToAdd)) {isAdded true;break;}}if (!isAdded) {final String[] newPaths Arrays.copyOf(paths, paths.length 1);newPaths[newPaths.length - 1] pathToAdd;usrPathsField.set(null, newPaths);}LOG.debug(java.library.path: System.getProperty(java.library.path));LOG.debug(usr_paths: Arrays.toString((String[]) usrPathsField.get(null)));usrPathsField.setAccessible(false);LOG.debug(类路径加载完成);// 监听F盘下的文件事件JNotify.addWatch(F:\\, JNotify.FILE_ANY, true, new JNotifyListener() {Overridepublic void fileRenamed(int wd, String rootPath, String oldName, String newName) {log.debug(wd wd , rootPath rootPath);log.debug(oldName oldName , newName newName);}Overridepublic void fileModified(int wd, String rootPath, String fileName) {log.debug(fileModified);}Overridepublic void fileDeleted(int wd, String rootPath, String fileName) {log.debug(fileDeleted);}Overridepublic void fileCreated(int wd, String rootPath, String fileName) {log.debug(fileDeleted);}});while (true) {}}}
http://www.pierceye.com/news/779389/

相关文章:

  • 建设网站商城需要多少费用注册网页代码
  • 徐州企业网站制作南宁网站建设专家
  • 雨发建设集团有限公司网站wordpress related posts
  • 成品网站速成网站大连专业app开发设计
  • 十堰门户网站建设中小企业网站制作407
  • 房产网站排行部署自己做的网站吗
  • 一_建设网站前的市场分析平台线上推广策略怎么写
  • 全国网站建设公司排名嘉兴网嘉兴网站建设
  • 渭南网站建设风尚网络python做网站显示表格
  • 网站访问过程服装定制行业的未来和趋势
  • 做拍卖网站多少钱怎么推广一个产品
  • 郑州做公司网站怎么做类似美团的网站吗
  • 网站建设服务公网站备案中是什么意思
  • 书店网站建设网站被k 如何恢复
  • 柳州做网站的企业瓯北网站制作
  • 南京建设银行网站蓬莱市住房和规划建设管理局网站
  • 网站前端用的到ps做教育app的网站有哪些
  • 有没有兼职做网站的低价自适应网站建设
  • 文成网站建设所有关键词
  • 吉林市做网站哪家好建网站的方法
  • 北京做网站的怎样用自己的服务器建设网站
  • 镇江建设局网站开发公司采购招聘
  • 阿里云编辑建设好的网站凡客官网登录入口网址
  • 后盾网原创实战网站建设教程北京app网站建设价格
  • 简述网站建设过程步骤wordpress英文建站
  • 网站开发 mvc有孩子做的网站
  • 自己做的网站如何推广wordpress 主题页脚
  • 数据库型网站怎么把电脑当服务器做网站
  • 东莞网站建设品牌公司如何做电子书网站
  • 免费学做美食视频网站有哪些百度是国企还是央企