Howto - Compiling OmegaT from the source code

Sorry this page has not yet been translated.

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)

The Java Development Kit is required. For OmegaT 4.0 and later, no additional software is required.

Earlier versions of OmegaT require Apache Ant.

You may have to set your JAVA_HOME environment variable to point to the location of the JDK.

2. Compile the code

Open a command-line window (console, DOS window). Navigate to the root of the OmegaT source code (the folder containing the file build.gradle), e.g.

cd C:\My Documents\MyOmegat\OmegaT_<version>_Beta_Source

OmegaT 4.0 or later

You can run OmegaT directly from the command line with

gradlew run

If this is all you're interested in, you can skip to step 3a.

To build the OmegaT program and all associated files, instead do

gradlew installDist

The results will be in the build\install\OmegaT.

Older versions of OmegaT

From within the root 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.

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

OmegaT_<version>_Beta_Source\dist

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

cd C:\My Documents\MyOmegat\OmegaT_<version>_Beta_Source\dist

and launch OmegaT with:

java -jar OmegaT.jar

3a. 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.

3b. 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