ZeroMQ Java安装问题

时间:2010-12-18 13:00:45

标签: java macos zeromq

我正在尝试安装ZeroMQ的Java library,但我遇到了问题。第一个错误是./configure抱怨JAVA_HOME,一切似乎都很好,但我无法解决它,但我在ZeroMQ's chat logs找到了一个特定的解决方案。

建议的解决方案是;

JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Home" ./configure

然而它对我不起作用。我收到的错误信息是

checking for jni.h in /Library/Java/Home/include... configure: error: cannot find jni.h in /Library/Java/Home/include.

我也尝试了JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Home" ./configureJAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home" ./configure,但仍然没有运气。我想听听StackOverflowers关于如何解决这个问题的想法。

感谢。

2 个答案:

答案 0 :(得分:7)

由于我从oracle安装了JDK1.7,所以我需要指定另一个JAVA_HOME

# prepare java home
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_06.jdk/Contents/Home
cd $JAVA_HOME
sudo ln -s include Headers
# fix jni_md.h: No such file or directory problem during `make`
sudo cp include/darwin/* include/
cd -
# do real stuff
git clone http://github.com/zeromq/jzmq
cd jzmq
./autogen.sh
JAVAC=$JAVA_HOME/bin/javac ./configure
make
sudo make install

然后用以下方法进行测试:(注意:测试后第一个local_lat将自行退出)

java -Djava.library.path=/usr/local/lib -classpath /usr/local/share/java/zmq.jar:perf/ local_lat tcp://127.0.0.1:5555 30 100 &
java -Djava.library.path=/usr/local/lib -classpath /usr/local/share/java/zmq.jar:perf/ remote_lat tcp://127.0.0.1:5555 30 100

应该打印mean latency

答案 1 :(得分:4)

我在Mac OSX Snow Leopard上为缺少的jni.h做了什么:

cd / Library / Java / Home

sudo ln -s /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Headers/./include