GATE Exception ! Can not guess GATE home Please set it manually

1k views Asked by At

I'm trying to call gate program from command prompt am using example from following code in this link:

http://gate.ac.uk/wiki/code-repository/src/sheffield/examples/StandAloneAnnie.java

Step 1 : I replaced StandAloneAnnie with a name "mario"

Step 2 : I added .jar and .zip files in classpath of my java program and a single document path in the argument.

Step 3 : complied it with no errors but with an exception , called the program in CMD prompt and I get following error !

Exception in thread "main" java.lang.reflect.InvocationTargetException..... Caused by: gate.until.GateRuntimeException: Cannot guess GATE Home. Please set manually

I tried both methods

Method 1 : using Gate.setGateHome(File) using following code before Gate.init()

 public static void main(String args[]) throws GateException, IOException {
// initialise the GATE library
Out.prln("Initialising GATE...");
Gate.setGateHome(new File("E:/Gate/Installation/"));
Gate.setPluginsHome(new File("E:/Gate/Installation/plugins/"));
Gate.setSiteConfigFile(new File("E:/Gate/Installation/gate.xml"));
Gate.init();
Out.prln("...GATE initialised");

Method 2: using this in cmd -Dgate.home=path/to/gate/home

java -jar mario.jar -Dgate.home=E:\Gate\Installation

More Information :

I'm using Java 1.7.45 My gate is in E:\Gate\Installation folder.

In Java i get following exception :

Exception in thread "main" java.net.MalformedURLException: unknown protocol: e
    at java.net.URL.<init>(URL.java:574)
    at java.net.URL.<init>(URL.java:464)
    at java.net.URL.<init>(URL.java:413)
    at mario.main(mario.java:98)

Am I doing something wrong in this. Please help.

Thank you.

1

There are 1 answers

0
user3506283 On

Try Putting GATE_HOME in environment variable directing to the Gate Root directory, This might solve your problem.

Also look for the references If you have changed/renamed any variable.

My suggestion is that first you try to run with default names then change/update name as required