Chapter 2
Installing and Running GATE [#]
2.1 Downloading GATE [#]
To download GATE point your web browser at http://gate.ac.uk/download/.
2.2 Installing and Running GATE [#]
GATE will run anywhere that supports Java 8 or later, including Linux, Mac OS X and Windows platforms. We don’t run tests on other platforms, but have had reports of successful installs elsewhere.
We recommend using OpenJDK 1.8 (or higher). This is widely available from GNU/Linux package repositories. The AdoptOpenJDK website provides packages for various operating systems, and is particularly suitable for Windows users. Mac users should install the JDK (not just the JRE).
2.2.1 The Easy Way [#]
The easy way to install is to use the installer (created using the excellent IzPack). Download the installer (.exe for Windows, .jar for other platforms) and follow the instructions it gives you. Once the installation is complete, you can start GATE Developer using gate.exe (Windows) or GATE.app (Mac) in the top-level installation directory, on Linux and other platforms use gate.sh in the bin directory (see section 2.2.4).
2.2.2 The Hard Way (1) [#]
- Download and unpack the ZIP distribution, creating a directory containing jar files and scripts.
- To run GATE Developer:
- on Windows, use the the ‘gate.exe’ file;
- on UNIX/Linux use ‘bin/gate.sh’.
- on Mac use ‘GATE.app’ – if running from a terminal you can keep GATE in the foreground using GATE.app/Contents/MacOS/GATE or bin/gate.sh
- To embed GATE as a library (GATE Embedded), put the JAR files in the lib folder onto your application’s classpath. Alternatively you can use a dependency manager to download GATE and its dependencies from the Central Repository by declaring a dependency on the appropriate version of group ID uk.ac.gate and artifact ID gate-core (see section 2.6.1).
2.2.3 The Hard Way (2): Git [#]
The GATE code is maintained in a set of repositories on GitHub. The main repository for GATE Developer and Embedded is gate-core, and each plugin has its own repository (typically with a name beginning gateplugin-).
All the modules (gate-core and the plugins) are built using Apache Maven version 3.5.2 or later. Clone the appropriate repository, checkout the relevant branch (“master” is the latest snapshot version), and build the code using mvn install
See section 2.6 for more details.
2.2.4 Running GATE Developer on Unix/Linux [#]
The script gate.sh in the directory bin of your installation (or distro/bin if you are building from source) can be used to start GATE Developer. You can run this script by entering its full path in a terminal or by adding the bin directory to your binary path. In addition you can also add a symbolic link to this script in any directory that already is in your binary path.
If gate.sh is invoked without parameters, GATE Developer will use the files ~/.gate.xml and ~/.gate.session to store session and configuration data. Alternately you can run gate.sh with the following parameters:
- -h
- show usage information
- -ld
- create or use the files .gate.session and .gate.xml in the current directory as the session and configuration files. If option -dc DIR occurs before this option, the file .gate.session is created from DIR/default.session if it does not already exist and the file .gate.xml is created from DIR/default.xml if it does not already exist.
- -ln NAME
- create or use NAME.session and NAME.xml in the current directory as the session and configuration files. If option -dc DIR occurs before this option, the file NAME.session is created from DIR/default.session if it does not already exist and the file DIR.xml is created from DIR/default.xml if it does not already exist.
- -ll
- if the current directory contains a file named log4j.properties then use it instead of the default (GATE_HOME/bin/log4j.properties) to configure logging. Alternately, you can specify any log4j configuration file by setting the log4j.configuration property explicitly (see below).
- -rh LOCATION
- set the resources home directory to the LOCATION provided. If a resources home location is provided, the URLs in a saved application are saved relative to this location instead of relative to the application state file (see section 3.9.3). This is equivalent to setting the property gate.user.resourceshome to this location.
- -d URL
- loads the CREOLE plugin at the given URL during the start-up process.
- -i FILE
- uses the specified file as the site configuration.
- -dc DIR
- copy default.xml and/or default.session from the directory DIR when creating a new config or session file. This option works only together with either the -ln, -ll or -tmp option and must occur before -ln, -ll or -tmp. An existing config or session file is used, but if it does not exist, the file from the given directory is copied to create the file instead of using an empty/default file.
- -tmp
- creates temporary configuration and session files in the current directory, optionally copying default.xml and default.session from the directory specified with a -dc DIR option that occurs before it. After GATE exits, those session and config files are removed.
- all other parameters
- are passed on to the java command. This can be used to e.g. set
properties using the java option -D. For example to set the maximum amount of
heap memory to be used when running GATE to 6000M, you can add -Xmx6000m
as a parameter. In order to change the default encoding used by GATE to UTF-8
add -Dfile.encoding=utf-8 as a parameter. To specify a log4j configuration file add
something like
-Dlog4j.configuration=file:///home/myuser/log4jconfig.properties.
Running GATE Developer with either the -ld or the -ln option from different directories is useful to keep several projects separate and can be used to run multiple instances of GATE Developer (or even different versions of GATE Developer) in succession or even simultanously without the configuration files getting mixed up between them.
2.3 Using System Properties with GATE [#]
During initialisation, GATE reads several Java system properties in order to decide where to find its configuration files.
Here is a list of the properties used, their default values and their meanings:
- gate.site.config
- points to the location of the configuration file containing the site-wide options. If not set no site config will be used.
- gate.user.config
- points to the file containing the user’s options. If not specified, or if the specified file does not exist at startup time, the default value of gate.xml (.gate.xml on Unix platforms) in the user’s home directory is used.
- gate.user.session
- points to the file containing the user’s saved session. If not specified, the default value of gate.session (.gate.session on Unix) in the user’s home directory is used. When starting up GATE Developer, the session is reloaded from this file if it exists, and when exiting GATE Developer the session is saved to this file (unless the user has disabled ‘save session on exit’ in the configuration dialog). The session is not used when using GATE Embedded.
- gate.user.filechooser.defaultdir
- sets the default directory to be shown in the file chooser of GATE Developer to the specified directory instead of the user’s operating-system specific default directory.
- gate.builtin.creole.dir
- is a URL pointing to the location of GATE’s built-in CREOLE directory. This is the location of the creole.xml file that defines the fundamental GATE resource types, such as documents, document format handlers, controllers and the basic visual resources that make up GATE. The default points to a location inside gate.jar and should not generally need to be overridden.
When using GATE Embedded, you can set the values for these properties before you call Gate.init(). Alternatively, you can set the values programmatically using the static methods setUserConfigFile(), etc. before calling Gate.init(). Note that from version 8.5 onwards, the user config file is ignored by default unless you also call runInSandbox(false) before init. See the Javadoc documentation for details.
To set these properties when running GATE developer see the next section.
2.4 Changing GATE’s launch configuration [#]
JVM options for GATE Developer are supplied in the gate.l4j.ini file on all platforms. The gate.l4j.ini file supplied by default with GATE simply sets two standard JVM memory options:
-Xms200m
-Xmx specifies the maximum heap size in megabytes (m) or gigabytes (g), and -Xms specifies the initial size.
Note that the format consists of one option per line. All the properties listed in Section 2.3 can be configured here by prefixing them with -D, e.g., -Dgate.user.config=path/to/other-gate.xml.
Proxy configuration can be set in this file – by default GATE uses the system-wide proxy settings (-Djava.net.useSystemProxies=true) but a specific proxy can be configured by deleting that line and replacing it with settings such as:
-Dhttp.proxyPort=8080
-Dhttp.nonProxyHosts=*.example.com
Consult the Oracle Java Networking and Proxies documentation1 for further details of proxy configuration in Java, and see section 2.3.
For GATE Embedded, note that Java does not automatically use the system proxy settings by default, you must set java.net.useSystemProxies=true explicitly to enable this.
2.5 Configuring GATE [#]
When GATE Developer is started, or when Gate.init() is called from GATE Embedded (if you have disabled the default “sandbox” mode), GATE loads various sorts of configuration data stored as XML in a file generally called something like gate.xml or .gate.xml in your home directory. This data holds information such as:
- whether to save settings on exit;
- whether to save session on exit;
- what fonts GATE Developer should use;
- plugins to load at start;
- colours of the annotations;
- locations of files for the file chooser;
- and a lot of other GUI related options;
Configuration data can be set from the GATE Developer GUI via the ‘Options’ menu then ‘Configuration’2. The user can change the appearance of the GUI in the ‘Appearance’ tab, which includes the options of font and the ‘look and feel’. The ‘Advanced’ tab enables the user to include annotation features when saving the document and preserving its format, to save the selected Options automatically on exit, and to save the session automatically on exit. These options are all stored in the user’s .gate.xml file.
2.6 Building GATE [#]
Note that you don’t need to build GATE unless you’re doing development on the system itself.
Prerequisites:
- A conforming Java environment as above.
- A clone of the relevant Git repository or repositories (see Section 2.2.3).
- A working installation of Apache Maven version 3.5.2 or newer. It is advisable that you also set your JAVA_HOME environment variable to point to the top-level directory of your Java installation.
- An appreciation of natural beauty.
To build gate-core, cd to where you cloned gate-core and:
- Type:
mvn install - [optional] To make the Javadoc documentation:
mvn site
In order to be able to run the GATE Developer you just built, you will also need to cd into the distro folder and run mvn compile in there, in order to create the classpath file that the GATE Developer launcher uses to find the JARs.
To build plugins cd into the plugin you just cloned and run mvn install. This will build the plugin and place it in your local Maven cache, from where GATE Developer will be able to resolve it at runtime.
Note if you are building a version of a plugin that depends on a SNAPSHOT version of gate-core then you will need to add some configuration to your Maven settings.xml file, as described in the gate-core README file.
2.6.1 Using GATE with Maven/Ivy [#]
This section is based on contributions by Marin Nozhchev (Ontotext) and Benson Margulies (Basis Technology Corp).
Stable releases of GATE (since 5.2.1) are available in the standard central Maven repository, with group ID “uk.ac.gate” and artifact ID “gate-core”. To use GATE in a Maven-based project you can simply add a dependency:
<groupId>uk.ac.gate</groupId>
<artifactId>gate-core</artifactId>
<version>8.5</version>
</dependency>
Similarly, with a project that uses Ivy for dependency management:
You do not need to do anything to allow GATE to access its plugins, it will fetch them at runtime from the internet when they are loaded.
Nightly snapshot builds of gate-core are available from our own Maven repository at http://repo.gate.ac.uk/content/groups/public.
2.7 Uninstalling GATE [#]
If you have used the installer, run:
or just delete the whole of the installation directory (the one containing bin, lib, Uninstaller, etc.). The installer doesn’t install anything outside this directory, but for completeness you might also want to delete the settings files GATE creates in your home directory (.gate.xml and .gate.session).
2.8 Troubleshooting [#]
See the FAQ on the GATE Wiki for frequent questions about running and using GATE.
1see https://docs.oracle.com/javase/8/docs/technotes/guides/net/proxies.html
2On Mac OS X, us the standard ‘Preferences’ option in the application menu, the same as for native Mac applications.