Howto - Compiling OmegaT from the source code

OmegaT HowTo:
Compiling OmegaT from the source code

This HowTo describes how to compile OmegaT from the source code.

OmegaT is supplied ready-compiled for a number of platforms, including a cross-platform version. Users do not therefore need to compile OmegaT themselves. Compiling OmegaT is relevant for developers who wish to make modifications of their own to its code.

1. Download and install the Java Development Kit (JDK) and Apache Ant

Various programs can be used to compile the source code again after you have modified it, but among the most convenient is Apache Ant. The Java Development Kit (JDK) is also required.

Depending upon how you install the Java Development Kit, you may have to change your "JAVA_HOME" attribute in order for it to function with Ant.

2. Compile the code

The folder names indicated below are for illustration only; version numbers will change.

Open a command-line window (console, DOS window). Change folder to the main folder in the OmegaT source code (the folder containing the file build.xml), e.g.

cd C:\My Documents\MyOmegat\OmegaT_2.2.3_Beta_Source

From within this folder, execute Apache Ant by entering the ant executable. It may be necessary to enter the full path, e.g.:

C:\Program Files\apache-ant-1.7.0-bin\apache-ant-1.7.0\bin\ant

If the code compiles successfully, you will see the "BUILD SUCCESSFUL" message. If not, debugging messages will be shown which will (hopefully) provide some idea of where the problem is.

3. Launch OmegaT

If your code has compiled successfully, the compiled OmegaT is placed in:

OmegaT_2.2.3_Beta_Source\dist

Still in your command-line window, change to this folder, e.g. with:

cd C:\My Documents\MyOmegat\OmegaT_1.8.0_01_Beta_Source\dist

and launch OmegaT with:

java -jar OmegaT.jar

4a. 1st example modification: changing the colour of segment highlighting

In the folder

src/org/omegat/gui/editor

open the file SegmentBuilder.java in a text editor.

Find the lines:

return Styles.createAttributeSet(fg, Styles.COLOR_GREEN, true, null);

and

b = Styles.COLOR_GREEN;

and replace

COLOR_GREEN

with

COLOR_BLUE.

In the folder

src/org/omegat/util/gui

open the file Styles.java in a text editor.

Find the line

public static final Color COLOR_GREEN = new Color(192, 255, 192);

Replace

COLOR_GREEN

with

COLOR_BLUE

and

192, 255, 192

with

225, 225, 255.

4b. 2nd example modification: increasing the number of fuzzy matches displayed from five to ten

In the folder

/src/org/omegat/util

open the file OConsts.java in a text editor.

Find the lines:

/** Number of fuzzy matches to display */
public static final int MAX_NEAR_STRINGS = 5;

and replace

= 5

with

= 10

For both examples, compile and test as described above.

Copyright Marc Prior 2011-2012