Installing JDEE

There are two ways to install the JDEE software.

Note: the instructions in this document apply to JDEE release 2.4.1 or later.

Dependencies

To use JDEE you need

To build JDEE from source you also need

This document assumes that the reader knows how to install and use GNU Emacs and the chosen JDK.

Installing the Binary Distribution

Download the latest binary distribution of JDEE (you can also use the source distribution files if you prefer) and extract it into a installation directory of your choice. For example, after you download the compressed tar file to ~/Downloads, you can install the JDEE to~/.emacs.d/ like this

$ cd ~/.emacs.d
$ tar jxf ~/Downloads/jdee-bin-2.4.1.bz2

This will install the JDEE distribution under ~/.emacs.d/jdee-2.4.1 after which Emacs needs to be told to load the JDEE code and use it when visiting Java source files. This is done with following two Emacs Lisp functions

(add-to-list 'load-path "~/.emacs.d/jdee-2.4.1/lisp")
(load "jde")

You should add these two lines to your Emacs initialization file (with the path to the JDEE directory adjusted to your chosen installation location) so JDEE is available each time you start Emacs. The initialization file is typically ~/.emacs.d/init.el (or ~/.emacs).

That's it. When you next visit a Java source file you will automatically be put in jde-mode. Read the JDE User Manual for details on how to use all the features that this mode makes available.

On Mac OS X and GNU/Linux systems JDE will automatically try to detect and set up your default Java installation (unless JAVA_HOME is set in your environment). On other systems you might need to customize jde-jdk-registry and jde-jdk before code navigation, documentation lookup and other features work. Please see the help for these two variables in any case.

Building From Source

Getting the latest source

The JDEE source code repository is maintained with Subversion. The repository mostly follows the standard layout; the main development code is in the trunk subdirectory, branches are in branches, and release tags are in tags. You will need a svn client to check out the source code, see the Subversion Binary Package to get started if your OS platform does not provide a packaged client. You can check out the latest ("trunk") code into a directory named jdee as follows

svn co https://jdee.svn.sourceforge.net/svnroot/jdee/trunk/jdee jdee

Note the extra level named jdee inside the trunk directory that you have to add. It might trip you up since it is not quite what you might be expecting.

Compile Time Dependencies

Building JDEE requires both Apache Ant, a Java based build tool, and the ant-contrib task library. Your host operating system should be the first place to look for these. Most Linux distributions provide packages named ant and ant-contrib that you can install with the system package manager. For example, on a Debian system (and derivatives, like Ubuntu) with Java already installed you might do the following

$ sudo apt-get install ant ant-contrib
$ mkdir -p ~/.ant/lib
$ ln -s /usr/share/java/ant-contrib.jar ~/.ant/lib

Note that even with the native ant-contrib packages installed you still need to install the ant-contrib JAR file to your ~/.ant/lib directory. This is because the JDEE build file expects that Ant will find the ant-contrib JAR file in its class path automatically.

On most RPM based systems (e.g. Fedora, CentOS, OpenSUSE) replacing apt-get with the native package manager (like yum) in the commands above should get you going.

Mac OS X provides Apache Ant as part of its Java development tool set (XCode is a free download, and it is also on the install DVD if you got one). So you will need to download only the ant-contrib library (you could also choose to get both ant and ant-contrib, and also GNU Emacs and much more, via the Mac Ports project, but that is beyond the scope of this document). After you have downloaded the ant-contrib distribution you would do the following

$ tar zxf ~/Downloads/ant-contrib-1.0b2-bin.tar.gz 
$ mkdir -p ~/.ant/lib
$ cp ant-contrib/lib/ant-contrib.jar ~/.ant/lib

In place installation instructions for dependencies on Windows here would be nice

Configuring the Build

Even though Ant is used to build and install JDEE, the build uses what are best described as automake/make conventions. Building the source is a two step process where you first configure build settings, and then you build and install. This legacy is largely due to the large number of external dependencies in JDEE during it's early life. With JDEE 2.4.1 and later there is nearly zero configuration required, but you still have to go through the motions of configuring the build.

The configuration step produces a file called build.properties at the root of the JDEE source tree. This file is not added to subversion (in fact it is set to be ignored by subversion) and it contains per build specific settings. The intention is to make modifications to this file so you don't have to modify build.xml for your own build. This generated build.propertiesfile has the following format:

#user editable build configuration parameters
#Sun, 07 Oct 2012 16:43:21 -0700

config.time=2012/10/07 16\:43
cedet.dir=
elib.dir=
prefix.dir=/usr/local/jdee
build.bin.emacs=emacs

You may edit the generated file to change the following build related properties in it:

There is one other idiosyncrasy specific to the JDEE build process you should be aware of. When the build.properties configuration file is generated JDEE picks default values for each property. These defaults are set in the version controlled JDEE code. There may be times when you want to modify the defaults themselves without modifying any version controlled files. An example would be when you are modifying and testing the build process itself; having to continously re-generate and edit the build.properties file can get tiresome very quickly. In this case you can create a ~/.jdee-config.properties file and put in it any property settings you want as defaults for your own tree. When you now (re)generate build.properties, the build script will use property values found in ~/.jdee-config.properties before using the defaults set in the source tree.

Note: On Windows ~/ is the directory defined by the Java user.home property. For example, this will be a subdirectory named after the user under C:/Documents and Settings/ on Windows XP.

So, the steps for configuring a JDEE build are then

  1. ant clean-all
    

    This will remove all built files, and also delete the generated build.properties file (along with any local modifications you might have made to that file). Use this command when you want to redo the configuration process. Of course, you do not need to do this right after you check out a clean copy of the code!

  2. ant configure
    

    This will generate the build.properties file if it does not already exist. The generated file will use any values in ~/.jdee-config.properties to override default property settings. If you want to re-generate the file use the ant-clean target first, or just manually delete the file.

  3. Examine the generated build.properties file and change anything you want. If you find yourself making the same change many times, consider putting the property definitions in ~/.jdee-config.properties instead.

Compiling and Installing

The following ant targets will build and install the JDEE software once the configuration step is completed (note that due to dependency resolution, they will also create the build.properties if it is missing, but you will not get a chance to modify it before the build finishes!).

  1. ant build
    

    This step compiles the both the Java and Emacs Lisp code. You can use the targets build-java and build-lisp to build only a subset of the code.

  2. ant install
    

    This will install the JDEE distribution to the directory set by the prefix.dir property in build.properties. The installation can be used by adding the following configuration to your Emacs initialization file

    (add-to-list 'load-path "path to installation lisp sub-directory here")
    (load "jde")
    

    You can simply set the load path to the build/lisp subdirectory in the source tree if you want to use the build without installing it.

  3. ant bindist
    

    This builds the binary release files and places them under dist/jdee-<version>. You can also use the package target to build a full binary distribution and install it as a binary distribution (this requires further dependencies that are not currently documented here).

  4. ant clean
    

    This will delete all generated objects. Note that unlike clean-all this target does not delete the generated build.properties file.

Using Upstream CEDET

If you are a JDEE developer and want to use the upstream CEDET distribution there are two things you need to do. First, set the cedet.dir property in the build.properties file (or, if you are using it, in ~/.jdee-config.properties) to the location of the cedet installation. Second, you must load the external CEDET before Emacs loads any part of its own CEDET. Your initialization file should do this as early as possible in the start up:

;; get local cedet load set up early
(load-file "/path/to/cedet/dir/common/cedet.elc")
(add-to-list 'load-path "/path/to/jdee/installation/lisp")
(load "jde")

Note that using upstream CEDET is not encouraged at this time. Building features with upstream CEDET will require that those features be included in GNU Emacs, that JDEE directly integrate the upstream code so that it works with the GNU Emacs bundled CEDET, or that JDEE will require upstream CEDET code and will not work with GNU Emacs directly. None of these options should be chosen lightly!

Known Working Configurations

Debian

Debian Wheezy (the stable release as of May 2013) no longer includes a JDEE package. The following configuration is known to work just fine:

Mac OS X

GNU Emacs 24 is available for Mac OS X via the Mac Ports project (among other ways to get it). JDEE is easily installed on such a system from source using the instructions above. The following configuration is known to work

Windows 7

JDEE 2.4.1 has been reported as working on Windows 7 with GNU Emacs 24.3.1. Unlike Mac OS X or GNU/Linux systems there is no support for automatically initalizing jde-jdk-registry and jde-jdk. Please customize both of these for your Java installation.


Shyamal Prasad, Paul Landes