本文介绍了设置系统属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试按照此指令运行嵌入式门

I am trying to follow this instruction for running gate embedded

它说:系统属性gate.home应设置为门安装目录。 (http://gate.ac.uk/wiki/code-repository/)

It says: "System property gate.home should be set to the gate installation directory." (http://gate.ac.uk/wiki/code-repository/)

我该怎么做?

当我尝试运行EmbeddedAnnie的示例代码时,我收到以下错误:
(我不知道它是否相关)。

Also when I try to run the example code of EmbeddedAnnie I get the following error:( I don't know if it is related or not ).

Initialising GATE...
GATE home system property ("gate.home") not set.
Attempting to guess...
Using "C:\Program Files (x86)\GATE-6.0" as GATE Home.
If this is not correct please set it manually using the -Dgate.home option in yo
ur start-up script
Using C:\Program Files (x86)\GATE-6.0 as GATE home
Using C:\Program Files (x86)\GATE-6.0\plugins as installed plug-ins directory.
Using C:\Program Files (x86)\GATE-6.0\gate.xml as site configuration file.
Using C:\Users\UNST\gate.xml as user configuration file
Using C:\Users\UNST\gate.session as user session file
Exception in thread "main" java.lang.NoClassDefFoundError: gate/creole/gazetteer
/AbstractGazetteer
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:14
1)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
        at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:296)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:296)
        at gate.util.GateClassLoader.loadClass(GateClassLoader.java:63)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        at gate.creole.CreoleAnnotationHandler.processAnnotationsForResource(Cre
oleAnnotationHandler.java:193)
        at gate.creole.CreoleAnnotationHandler.processAnnotations(CreoleAnnotati
onHandler.java:169)
        at gate.creole.CreoleAnnotationHandler.processAnnotations(CreoleAnnotati
onHandler.java:173)
        at gate.creole.CreoleAnnotationHandler.processAnnotations(CreoleAnnotati
onHandler.java:173)
        at gate.creole.CreoleAnnotationHandler.processAnnotations(CreoleAnnotati
onHandler.java:157)
        at gate.creole.CreoleRegisterImpl.processFullCreoleXmlTree(CreoleRegiste
rImpl.java:358)
        at gate.creole.CreoleRegisterImpl.parseDirectory(CreoleRegisterImpl.java
:341)
        at gate.creole.CreoleRegisterImpl.registerDirectories(CreoleRegisterImpl
.java:306)
        at gate.Gate.initCreoleRepositories(Gate.java:449)
        at gate.Gate.init(Gate.java:230)
        at StandAloneAnnie.main(StandAloneAnnie.java:69)
Caused by: java.lang.ClassNotFoundException: gate.creole.gazetteer.AbstractGazet
teer
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        ... 27 more

Ted。

推荐答案

你可以通过几种方式做到这一点。

You can do this via a couple ways.

一个是当你运行你的应用程序时,你可以传递一个标志。

One is when you run your application, you can pass it a flag.

java -Dgate.home =http://gate.ac.uk / wiki / code-repositoryyour_application

或者在需要设置此属性的代码片段之前以编程方式设置它。 Java为系统宽配置保留属性对象。

Or set it programmatically in code before the piece of code that needs this property set. Java keeps a Properties object for System wide configuration.

Properties props = System.getProperties();
props.setProperty("gate.home", "http://gate.ac.uk/wiki/code-repository");

这篇关于设置系统属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-27 00:54