在Mac OS X上使用JNotify? [英] JNotify on Mac OS X?

查看:202
本文介绍了在Mac OS X上使用JNotify?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想尝试JNotify,这是用于监视文件系统更改的插件库,但无法弄清楚如何配置它。 JNotify的网页说java.library.path应该指向jnotify附带的本机库的位置(dll,所以dylibs等)。我是Mac OS X的新手,并不知道如何做到这一点。我正在使用NetBeans,并希望有一种简单的方法将其添加到那里的路径。我通过简单地将jar文件添加到项目中的Libraries节点并通过import net.contentobjects.jnotify。*;导入它来尝试它,但这没有帮助。我得到了这个:

I want to try JNotify, the plugin library for watching file system changes, but cannot figure out how to configure it. The web page for JNotify says that "java.library.path should point to the location of the native libraries that comes with jnotify (dlls, so dylibs etc)". I am rather new to Mac OS X and don't really know how to do this. I'm using NetBeans and was hoping there was a simple way of adding it to the path in there. I tried it by simply adding the jar file to the Libraries node in the project, and importing it by "import net.contentobjects.jnotify.*;", but that didn't help. I'm getting this:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no jnotify in java.library.path

我似乎还需要添加本机库(Mac的.so文件)路径。

It also seems I need to add native libraries (.so file for Mac I guess) into the same path.

那我该怎么做?

推荐答案

java.library.path 是一个Java系统变量,你必须使用 -D 开关设置这个特定的变量。启动该程序:

java.library.path is a Java system variable, you have to set this particular one by using the -D switch when launching the program:

java -Djava.library.path=/path/to/dylibs your.MainClass

在项目属性的某处启动程序时,应该可以告诉Netbeans添加一些命令行参数。

It should be possible to tell Netbeans to add some command line parameters when starting your program somewhere in your project's properties.

在OS X上,您想要的目录是 .dylib 文件所在的位置,而不是。所以那些。

On OS X, the directory you want is wherever the .dylib files are, not the .so ones.

这篇关于在Mac OS X上使用JNotify?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆