Subclipse is a great subversion plugin for Eclipse allowing very tight integration into the IDE. Installing it on a 64-bit JVM is a bit tricky, however, and not as straightforward as it probably should be. Today’s post will walk through setting up Subclipse on a fresh Eclipse install.
We’ll be doing this the “right way”, using public key authentication (“passwordless”), but I’ll also point out the steps that can be skipped if you want to enter a password each time with an asterisk*. Note: entering a password for every transaction gets very tedious and I would recommend using public key authentication as I outline.
First, I’ll list the versions I’m working with:
- Java: 1.7.0_03(x64)
- Eclipse: 3.7.2 (Indigo) (x64)
- SilkSVN: 188.8.131.52 (x64)
- Subclipse: 1.8
You’re free to use a newer version if this post becomes outdated, but things may change which may or may not invalidate this walkthrough.
A 64-bit JVM installed. Installing subclipse is presumably a lot easier if you have a 32-bit JVM installed.
- Install Eclipse (Indigo x64)
- Install Subclipse via Eclipse (Help – Intstall New Software – Add)
- Exit Eclipse
Download and Install SlikSVN — This is needed for the 64-bit JavaHL libraries. (What is JavaHL and why do I need it?) Make sure you select the 64-bit edition. Ensure you have MSVC++ 2010 (x64) Redistributable Package Installed. If you think you have this installed, you can skip this step. If you encounter an Eclipse error dialog stating: no msvcp100 in java.library.path, you’re missing this.
- Install TortoiseSVN (or just download TortoisePlink.exe). Note that TortoisePlink.exe is different than the PLINK.EXE that is provided by the PuTTY package and using that version will not work.
- Download Puttygen.exe* (available here, either as part of the entire PuTTY package or alone). Note that this step will be necessary if (a) you want to use passwordless login and (b) you don’t already have a private/public keypair (if you’re unsure about this, you probably don’t have one and generating another one is no big deal).
- Create Public / Private Keypair using Puttygen.exe* — save these somewhere you’ll remember (I use %HOMEPATH%\Keys which is (on Win7) C:\Users\<username>\
- Install public key on remote computer.* Note: this might depend on the OS of your subversion server, but generally the steps are the same: (1) copy public key to subversion server, (2) add key to ~/.ssh/authorized_keys. Something like:
cat id_rsa.pub >> ~/.ssh/authorized_keys
- Configure Subclipse to use plink. Open %appdata%\Subversion\config and in the [tunnels] section, add the line
ssh = C:/Progra~2/Putty/TortoisePlink.exe -l username -i C:/path/to/private_key
Notes: (1) change paths and username as appropriate, (2) The path separator should either be a single forward slash or a double (escaped) backslash. If you decide not to use public key authentication, drop the last (i) option.
- Launch Eclipse
- Open SVN Configuration (Window – Preferences – Team – SVN) and ensure JavaHL (JNI) 1.7.5 … is selected under (SVN Interface – Client) and an error dialog isn’t displayed. If you get an error dialog and the dropdown contains JavaHL (JNI) Not available, you may have forgot to exit and restart Eclipse or something went wrong while installing SlikSVN.
- Add repository (Window – Open Perspective – Other… – SVN Repository Explorer – Right click in “SVN Repositories” – New – Repository Location) and enter repo location (svn+ssh://subversion.server/path/to/repo)
At this point, one of four things should happen:
- Your repository opens up in the Repo Browser. Congrats! You set up Subclipse successfully. Code on!
- A password dialog opens up. Typically this is because either (a) you erred when specifying your private key on the ssh=… line, or (b) you didn’t, or didn’t correctly, add the public key to the authorized_keys file.
- You get a red console error:
Network connection closed unexpectedly
svn: Unable to connect to a repository at URL ‘svn+ssh://path/to/repo’
svn: To better debug SSH connection problems, remove the -q option from ‘ssh’ in the [tunnels] section of your Subversion configuration file.
This means that you were able to connect to the server, but for some reason the connection later failed. This could be because you specified an incorrect username. Ensure your TortoisePlink.exe options are correct.
- You get a red console error:
The system cannot find the file specified.
svn: Unable to connect to a repository at URL ‘svn+ssh://path/to/repo/’
svn: Can’t create tunnel: The system cannot find the file specified.
This means that Subclipse couldn’t locate TortoisePlink.exe. Ensure your path is correct and your path separators are appropriate.