Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Paired JAR and native library binaries for SVN Java bindings (JavaHL) on Windows?

I'm writing some code that uses the Subversion (SVN) Java bindings (JavaHL) directly (where JavaHL comprises native libraries and a thin Java wrapper). On Linux (Ubuntu 12.04) this is no problem: package libsvn-java installs the native libraries and \usr\share\java\svn-javahl.jar, so i just reference the latter and away I go.

On Windows, I know of no such clean packaging of the pair (JAR + native libraries) together. I was aware that SlikSVN contains a JavaHL implementation, but installing that seems only to install the native libraries (which it does put on the PATH). Is there anything that gives a clean package of the two? (If SlikSVN does package the JAR, it's in no place I expect, and a search of the whole drive finds nothing...)

As a workaround, I built the JAR file manually (details below which may be useful for people). But it seems that the 'match' of Java wrapper and native libraries is very precise: when I built a JAR from later SVN source code (instead of that matching my exact SlikSVN SVN version) as a test, I got fatal errors in the native code (EXCEPTION_ACCESS_VIOLATION). Perhaps I was unlucky but, if it is pretty sensitive, I'll need to provide a JAR library for every potential version of SlikSVN (and thus SVN) that users might install (or restrict their SlikSVN choices, or have some prone-to-error auto-build process which would need them to install a JDK). All bad options :-(

Manual Workaround (Bad!)

I had SlikSVN 1.8.10: svn --version reports version 1.8.10-SlikSvn-1.8.10-X64.

So I got the Java wrapper source from the tagged SVN release. (You can also get it from the main site's source downloads.)

svn export http://svn.apache.org/repos/asf/subversion/tags/1.8.10/subversion/bindings/javahl/src

Compiling this (there are no dependencies) into a JAR, and using that, worked fine with the SlikSVN native libraries.

P.S. I know that I could use SVNKit to avoid having to do this, but I'm doing this precisely so as not to rely on SVNKit for licensing reasons (plus the JavaHL API is fine and reasonably high-level anyway, and there are other reasons to prefer using the 'official' native JavaHL implementation).

like image 528
Stuart Rossiter Avatar asked Nov 10 '22 23:11

Stuart Rossiter


1 Answers

The WANdisco binaries should have JavaHL in them.

http://www.wandisco.com/subversion/download

Been a while since I used them myself (don't typically use Windows). But WANdisco has tools that depend on JavaHL so I can't imagine the Windows binaries are missing JavaHL.

[Question author edit to complete detail]

You need to install the (Windows) Subversion client (not SmartSVN), and make sure you check the box to add it to the Windows PATH. This stores the 'paired' JAR in the install directory (along with the native libraries). However, WANDisco only provide a 32-bit install (see this forum post) so this won't work on 64-bit Windows. In addition, the JAR only includes the Apache versions of the API, which were added for Subversion 1.7. If you're using the legacy org.tigris.subversion.javahl package API for compatibility with pre-1.7 SVN clients, you still need to build the JAR manually.

like image 200
Ben Reser Avatar answered Nov 14 '22 21:11

Ben Reser