Wednesday 26 December 2012

Installing Maven, Eclipse, Subversion and RabbitVCS on Linux Mint 14 (Cinnamon)


This guide will help you get set up for Java development on Linux Mint 14 (Cinnamon), using Maven, EclipseSubversion and RabbitVCS.

Prerequisites

  • Linux Mint 14 (Cinnamon) installed (download here)

Install Oracle JDK7 (Optional)

My distribution came with OpenJDK 7 JRE. You can install the OpenJDK 7 JDK from the official repositories (sudo apt-get install openjdk-7-jdk), but I prefer to use the Oracle JDK (which isn't in the offical repositories due to licensing issues). If you're happy with OpenJDK then you can skip this step and install the OpenJDK instead (just note that the Java directory will be different for the next section when installing Maven 3).
  • Open a terminal (Ctrl-Alt-t)
  • Add the required APT repository
    sudo add-apt-repository ppa:webupd8team/java
  • Update the APT indexes
    sudo apt-get update
  • Install the Oracle JDK
    sudo apt-get install oracle-java7-installer
  • Accept the licence terms
  • Confirm the Oracle JDK is installed
    java -version

Install Maven 3

Sonatype's Maven manual is an excellent reference for installing and using Maven, but for quick reference here are the steps to install Maven 3.0.4.
  • Download the binary (apache-maven-3.0.4-bin.tar.gz) from the Apache Maven website
  • Open a terminal (Ctrl-Alt-t)
  • Navigate to the file and extract it
    cd ~/Downloads/
    tar xzf apache-maven-3.0.4-bin.tar.gz
  • Move it to /usr/local (as suggested in the installation guide in the Maven manual) and create a symbolic link
    sudo mv apache-maven-3.0.4 /usr/local
    cd /usr/local
    sudo ln -s apache-maven-3.0.4 maven
  • Ensure that the required environment variables and path are configured for Java and Maven by adding the following lines to the appropriate script (I used ~/.profile)
    # setup environment variables/path for Java/Maven
    export M2_HOME=/usr/local/maven
    export M2=$M2_HOME/bin
    export JAVA_HOME=/usr/lib/jvm/java-7-oracle
    export PATH=$M2:$JAVA_HOME/bin:$PATH
  • Log out and in again
  • Open a terminal (Ctrl-Alt-t)
  • Check that Maven is configured correctly
    mvn -v
  • If you've done everything correctly, this should print results similar to:
    Apache Maven 3.0.4 (r1232337; 2012-01-17 18:44:56+1000)
    Maven home: /usr/local/maven
    Java version: 1.7.0_10, vendor: Oracle Corporation
    Java home: /usr/lib/jvm/java-7-oracle/jre
    Default locale: en_AU, platform encoding: UTF-8
    OS name: "linux", version: "3.5.0-17-generic", arch: "amd64", family: "unix"

Install Eclipse

To install Eclipse Juno in your home directory
  • Download the package (I chose `Eclipse IDE for Java Developers') from the Eclipse website
  • Open a terminal (Ctrl-Alt-t)
  • Extract Eclipse and move to your home directory
    cd ~/Downloads
    tar xzf eclipse-java-juno-SR1-linux-gtk-x86_64.tar.gz
    mv eclipse ~
  • Right-click on the Menu in the bottom-left and choose 'Edit menu'
  • Click on the 'Programming' group, then click the 'New item' button
  • Add the following details for Eclipse and click the 'OK' button
    Type: Application
    Name: Eclipse
    Command: /home/yourusername/eclipse/eclipse
  • Optionally, navigate (or search) to Eclipse in the menu, right-click and choose 'add to desktop'
  • Verify that Eclipse was installed successfully by launching it from the menu (or desktop shortcut) 
  • If you're using the Maven Eclipse plugin, you will also want to ensure Eclipse is configured with the classpath variable M2_REPO by running the following command:
    mvn eclipse:configure-workspace -Declipse.workspace=/path/to/your/workspace

Install Subversion

To install Subversion:
  • Open a terminal (Ctrl-Alt-t)
  • Install Subversion
  • sudo apt-get install subversion
  • Confirm subversion is installed
    svn --version

Install RabbitVCS

RabbitVCS is an excellent GUI tool for Subversion. Unfortunately, there's no official support for Nemo (the new file manager for Cinnamon), but until there is there is a workaround (on the rabbitvcs issue tracker).

First, install rabbitvcs-core:
  • Open a terminal (Ctrl-Alt-t)
  • Add the required APT repository
    sudo add-apt-repository ppa:rabbitvcs/ppa
  • Update the APT indexes
    sudo apt-get update
  • Install rabbitvcs-core
    sudo apt-get install rabbitvcs-core
Now apply the workaround:
  • Download the RabbitVCS.py attachment from comment 5 of the rabbitvcs issue
  • Add the required APT repository
    sudo add-apt-repository ppa:gwendal-lebihan-dev/cinnamon-stable
  • Update the APT indexes
    sudo apt-get update
  • Install python-nemo
    sudo apt-get install python-nemo
  • Copy the RabbitVCS.py patch to the appropriate location
    cd ~/Downloads
    sudo mv RabbitVCS.py /usr/share/nemo-python/extensions/
  • Log out and in again
You should now be able to see the RabbitVCS entries on the right-click menu, as well as the Subversion icon overlays for any of your Subversion repositories.

And that's it! You should be up and running for Java development on Linux Mint :)

14 comments:

  1. Awesome! This worked for me, thanks!

    ReplyDelete
  2. Great! I have noticed RabbitVCS crashes on me mid-commit - I'm not sure why yet, as it works sometimes...

    ReplyDelete
  3. Thanks for the RabbitVCS summary. Very happy to have that working as I migrate to Mint 14.

    ReplyDelete
  4. Great... just comment...for RabbitVCS nemo support, It's no necessary log out & in...
    just nemo -q, and then nemo. :-) works perfect thanks ..

    ReplyDelete
  5. Great article. In addition, I wanted an h2 DB, so I did the ff:
    download h2 zip
    unzip h2-2013-03-17.zip
    sudo mv h2 /usr/local/
    cd /usr/local/
    sudo gedit ~/.profile

    # setup environment variables/path for Java/Maven
    export M2_HOME=/usr/local/maven
    export M2=$M2_HOME/bin
    export JAVA_HOME=/usr/lib/jvm/java-7-oracle
    export H2_HOME=/usr/local/h2
    export PATH=$M2:$JAVA_HOME/bin:$H2_HOME/bin:$PATH

    you can now run the h2 console via:
    sh $H2_HOME\bin\h2.sh

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. Thanks a LOT!!! It was a real challenge for me (a new Linux user) to install RabbitVCS.

    ReplyDelete
  8. i guess this not work on mint 15

    ReplyDelete
  9. For RabbitVCS on mint 15 64bit with Cinnamon:

    sudo apt-get install nemo-rabbitvcs
    sudo ln -s /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0 /usr/lib/libpython2.7.so.1.0
    nemo -q

    ReplyDelete
    Replies
    1. Anonymous 9 June 2013 06:06

      Thank you, u saved my time

      Delete
    2. awesome!!!... thanks a lot!! I could not install Rabbit, but this it works for me!!

      Delete
    3. Thanks for the tip

      Delete
  10. for those who wants RabbitVCS on mint 15 32bit with Cinnamon:
    sudo apt-get install nemo-rabbitvcs
    sudo ln -s '/usr/lib/i386-linux-gnu/libpython2.7.so.1.0' /usr/lib/libpython2.7.so.1.0
    nemo -q

    ReplyDelete
  11. any ideas how to fix this same issue in Mint 17? I believe the problem is the python link.... unsure how to troubleshoot it though, I'm in over my head!

    ReplyDelete