IT박스

시스템 속성 설정

itboxs 2020. 11. 26. 08:04
반응형

시스템 속성 설정


나는이 지시를 따르려고합니다.

"gate.home 시스템 속성은 게이트 설치 디렉토리로 설정되어야합니다." (http://gate.ac.uk/wiki/code-repository/)

어떻게해야합니까?

또한 EmbeddedAnnie의 예제 코드를 실행하려고하면 다음과 같은 오류가 발생합니다. (관련 여부를 모르겠습니다).

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

테드.


몇 가지 방법을 통해이 작업을 수행 할 수 있습니다.

하나는 애플리케이션을 실행할 때 플래그를 전달할 수 있다는 것입니다.

java -Dgate.home="http://gate.ac.uk/wiki/code-repository" your_application

또는이 속성 집합이 필요한 코드 전에 코드에서 프로그래밍 방식으로 설정하십시오. Java PropertiesSystem광범위한 구성을 위한 객체를 유지 합니다.

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

System.setProperty("gate.home", "/some/directory");

자세한 내용은 다음을 참조하십시오.


System.setProperty("gate.home", "/some/directory"); 

그런 다음 나중에 호출하여 값을 검색 할 수 있습니다.

String value =  System.getProperty("gate.home");

For JBoss, in standalone.xml, put after .

<extensions>
</extensions>

<system-properties>
    <property name="my.project.dir" value="/home/francesco" />
</system-properties>

For eclipse:

http://www.avajava.com/tutorials/lessons/how-do-i-set-system-properties.html?page=2


You need the path of the plugins directory of your local GATE install. So if Gate is installed in "/home/user/GATE_Developer_8.1", the code looks like this:

System.setProperty("gate.home", "/home/user/GATE_Developer_8.1/plugins");

You don't have to set gate.home from the command line. You can set it in your application, as long as you set it BEFORE you call Gate.init().

참고URL : https://stackoverflow.com/questions/5189914/setting-system-property

반응형