I am trying to use Gate embedded to extract some entities. I included the jar files from the bin and lib folder this is the code:
Out.prln("Initialising GATE...");
Properties props = System.getProperties();
props.setProperty("gate.home", "/Applications/GATE_Developer_8.2");
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
MainFrame.getInstance().setVisible(true);
try {
Factory.newDocument("This is a document");
} catch (ResourceInstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
but I always get the following exception. Does anyone know what I am doing wrong? Thanks
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.awt.EventQueue.invokeAndWait(EventQueue.java:1312)
at java.awt.EventQueue.invokeAndWait(EventQueue.java:1287)
at javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1348)
at gate.Gate.main(Gate.java:25)
Caused by: java.lang.NoSuchMethodError: gate.Gate.getUserConfig()Lgate/util/OptionsMap;
at gate.swing.XJFileChooser.getLocations(XJFileChooser.java:140)
at gate.swing.XJFileChooser.<init>(XJFileChooser.java:70)
at gate.gui.MainFrame.<init>(MainFrame.java:493)
at gate.gui.MainFrame.getInstance(MainFrame.java:352)
at gate.gui.MainFrame.getInstance(MainFrame.java:348)
at gate.Gate$1.run(Gate.java:27)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:749)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:702)
at java.awt.EventQueue$3.run(EventQueue.java:696)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:719)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
You have this error because the class is in the classpath but its version doesn't match with your need. The class is found but you invoke a method which doesn't exist in the version of this class.
I think that you should use a more recent version of the GATE library.
For example this version https://gate.ac.uk/releases/gate-3.1-build2270-ALL/doc/javadoc/ contains the
gate.Gate
class providing the public methodOptionsMap getUserConfig()
.