在Mac下安装Eclipse插件svnEclipse插件后,每次打开Eclipse都会弹出如下弹出框:
提示你本机缺少JavaHL Library。
选择Eclipse→偏好设置(preference)→Team→SVN,可以看到SVN接口Client的定义如下:
这说明当前系统中缺少JavaHL,需要我们手动安装。
subeclipse官网(http://subclipse.tigris.org/wiki/JavaHL 打开可能会非常慢)给出的介绍说有两种方式可以在Mac电脑上(OS X)上安装JavaHL Library,一种是通过MacPort,一种是通过HomeBrew的形式。如图所示:
这里我们主要介绍使用HomeBrew实行安装。
步骤1:安装HomeBrew:
HomeBrew的安装需要依赖XCode和Commond Line,具体的安装步骤如下:
1、安装Xcode
2、安装command line tools,打开终端,输入命令:
xcode-select - - install 这样mac 10.9以后的系统会安装command line tools
3、安装brew ,打开终端,输入命令:
curl -LsSf http://github.com/mxcl/homebrew/tarball/master | sudo tar xvz -C/usr/local --strip 1
4、更新brew ,打开终端,输入命令:(可忽略)
brew update
5、诊断系统 ,打开终端,输入命令:(可忽略)
brew doctor
HomeBrew的安装过程介绍网上也有很多教程,比如:
http://brew.sh/ --官网
http://www.jb51.net/os/MAC/101860.html
http://www.cnblogs.com/liulipeng/p/3938518.html
就不更多介绍了,如果安装过程遇到了问题,百度下基本都能解决的。
步骤2:执行命令,安装JavaHL
进入终端,键入如下命令:
brew install --universal --java subversion
但是会遇到如下问题,提示有个包下不到,原因你懂得,被墙了。
==> Downloading https://www.apache.org/dyn/closer.cgi?path=subversion/subversionAlready downloaded: /Library/Caches/Homebrew/subversion-1.8.13.tar.bz2==> Patchingpatching file configureHunk #1 succeeded at 25386 (offset 20 lines).patching file subversion/bindings/swig/perl/native/Makefile.PL.in==> Downloading https://serf.googlecode.com/svn/src_releases/serf-1.3.8.tar.bz2 curl: (7) Failed to connect to serf.googlecode.com port 443: Operation timed outError: Failed to download resource "subversion--serf"Download failed: https://serf.googlecode.com/svn/src_releases/serf-1.3.8.tar.bz2
这个问题也有解决的办法,那就是下载对应的包,放在对应的目录下,这样就能再安装JavaHL的过程中跳过serf-1.3.8.tar.bz2的下载了。
步骤2.1:下载serf-1.3.8.tar.bz2包:
http://download.csdn.net/detail/shanwenchao/8653245
下载后放在任意目录,将名称修改为:subversion--serf-1.3.8.tar.bz2
步骤2.2:将改名后的该文件放在目录下:
将修改后的文件放在/Library/Caches/Homebrew目录下。
步骤2.3:重新执行安装命令,安装JavaHL:
brew install --universal --java subversion
这是就不会下载而是直接从文件目录中取该包了。如下过程:
brew install --universal --java subversion Warning: subversion: --java was deprecated; using --with-java instead! ==> Downloading https://www.apache.org/dyn/closer.cgi?path=subversion/subversion Already downloaded: /Library/Caches/Homebrew/subversion-1.8.13.tar.bz2 ==> Patching patching file configure Hunk #1 succeeded at 25386 (offset 20 lines). patching file subversion/bindings/swig/perl/native/Makefile.PL.in ==> Downloading https://serf.googlecode.com/svn/src_releases/serf-1.3.8.tar.bz2 Already downloaded: /Library/Caches/Homebrew/subversion--serf-1.3.8.tar.bz2 ==> /usr/local/opt/scons/bin/scons PREFIX=/usr/local/Cellar/subversion/1.8.13/li ==> /usr/local/opt/scons/bin/scons install ==> ./configure --prefix=/usr/local/Cellar/subversion/1.8.13 --with-zlib=/usr --with-sqlite=/usr/local/opt/sqlite --with-serf=/usr/local/Cellar/subversion/1.8.13/libexec/serf --disa ==> make ==> make install ==> make tools ==> make install-tools ==> make javahl ==> make install-javahl ==> Caveats svntools have been installed to: /usr/local/opt/subversion/libexec You may need to link the Java bindings into the Java Extensions folder: sudo mkdir -p /Library/Java/Extensions sudo ln -s /usr/local/lib/libsvnjavahl-1.dylib /Library/Java/Extensions/libsvnjavahl-1.dylib Bash completion has been installed to: /usr/local/etc/bash_completion.d ==> Summary ?? /usr/local/Cellar/subversion/1.8.13: 119 files, 18M, built in 11.3 minutes
整个安装过程会持续很长时间,千万不要中途关掉终端。
步骤2.4:执行命令绑定Java环境和Java延伸目录的关系:
正如上面安装过程最后提示的那样:
You may need to link the Java bindings into the Java Extensions folder: sudo mkdir -p /Library/Java/Extensions sudo ln -s /usr/local/lib/libsvnjavahl-1.dylib /Library/Java/Extensions/libsvnjavahl-1.dylib
依次在终端中执行上面两句命令,整个安装过程就完成了。
安装后,在进入Eclipse查看SVN Client的配置如下:
问题解决~!
纵观整个安装过程,简要来说分为如下过程:
1:安装Brew;
2:下载包,改名,放在指定目录下;
3:执行安装命令,及其补充命令;
网上大多数介绍解决JavaHL not available的帖子都只介绍了第一步和第三部,却少了第二部,不知道他们是不是都是FQ安装或者是在国外安装的所以没有遇到被墙导致不能下载对应文件的问题。现加入步骤2,希望能够帮助大家解决该问题。
参考介绍:
http://bbs.csdn.net/topics/390972167
http://ju.outofmemory.cn/entry/90475