jEdit: February 2011 Archives

Getting started with jEdit hacking

| Comments | No TrackBacks

I really like jEdit. It’s not my choice for the environment of multi-file, complicated projects, but I use it very often for ad-hoc text, code and XML editing. So I decided to give back to the community a little and hack jEdit a bit.

In a few articles I’ll write my way through the mysteries of jEdit hacking, from the point of view of a newcomer.

In this article we will download, compile and debug with Eclipse the basic jEdit, without plugins.

Fetching the sources

Because I prefer Git to SVN, I decided to convert jEdit repo to local Git repos. So git svn to the rescue!

git svn init --branches=jEdit/branches/ --tags=jEdit/tags/ --trunk=jEdit/trunk/
git svn fetch

Well, because SourceForge likes to drop connection randomly on large SVN transfers, it’ll be much easier to wrap the last line in a while loop:

while ! git svn fetch; do
    echo "*** Retrying ***"

If you’re OK with only SVN, just checkout the repo:

svn co jEdit

The docs says you’ll also need build-support module, but for building plain jEdit (without modules), you don’t need it. If you ever need it, use the above instructions for fetching jEdit, replacing jEdit in the URL and path with build-support. Make sure to put build-support dir next to jEdit one.


jEdit build system is based on Ant. In Ubuntu required packages can be installed with:

aptitude install ant ant-optional

plus you will need a Java compiler — I won’t go into details here, leave a comment if you have problems.

README.SRC.txt is pretty straight-forward about the required steps to build the system. First, you must configure jEdit build system. Copy to and set up what necessary. Most defaults are fine, at the first shot I only setup the deprecation and warning policy (jEdit compilation gives a lot of warnings…):

# warning settings

Now, just compile:

ant build
# or just ant


If you want to run the just-compiled code, do it with

ant run

For serious hacking you will probably need debugger set up. I prefer Eclipse for my daily programming jobs, so we’ll use that.

In Eclipse, create new Java project, name it ‘jEdit’ (surprise!) and place it anywhere you want. Now, remove the default src folder and create a linked folder to the place where jEdit lives.

jEdit doesn’t use a separate source folder, sources are scattered in the main folder. Fortunatelly, there are not so many top-level packages, so not so many sub-folders.

Configure the project builder to use the just linked folder as the source folder. Configure inclusion/exclusion filter — we only need org.* packages. Resulting setting look like this:


This will allow us to setup breakpoints, navigate and read the code easily. I don’t care about Eclipse compilation as long as there are no errors.

The easiest way to debug jEdit is to run it outside Eclipse, with debugging agent, and to run remote debugging in Eclipse. To run jEdit with debugging server use:

ant run-debug

jEdit virtual machine will stop waiting for a connection from Eclipse (with one minute timeout). In Eclipse, create debug configuration (RunDebug Configurations…Remote Java ApplicationNew launch configuration) and point to localhost on port 5005. Click Debug and here you go, debugging jEdit. Good luck!

About this Archive

This page is an archive of entries in the jEdit category from February 2011.

jEdit: March 2011 is the next archive.

Find recent content on the main index or look in the archives to find all content.

jEdit: Monthly Archives


OpenID accepted here Learn more about OpenID