Download GATE first, it's like 320mb or something like that. Then, if you use netbeans, you can add GATE to yourself by going to the project -> Library -> right-click add jar files and go to the GATE installation file and select all the JAR files inside the lib folder. Once the entire jar file is there, you can use GATE. (See Chapter GATE.7 GATE Embedded).
A simple example is using ANNIE, there is standAloneAnnie where you only need to transfer the file and it will process it for you.
http://gate.ac.uk/wiki/code-repository/src/sheffield/examples/StandAloneAnnie.java
After you add ANNIE to your project, you can use it by calling it with the main method / you can later change its name and pass an array of files as a parameter. The file array must contain the file you want to process.
source share