Hello I get this error when I try the simple esample of the tutorial:
"grun Hello -r tree
Warning: TestRig moved to org.antlr.v4.gui.TestRig; calling automatically
Problems calling org.antlr.v4.gui.TestRig.main(args)
"
I cannot figure out what is going on.
Can you help me please.
It sounds like you have setup your 'grun' alias to use :
org.antlrv4.runtime.misc.TestRig
//and from antlr4 onwards they deprecated that and use this instead.
org.antlrv4.gui.TestRig
So you should try resetting your 'grun' alias either from terminal or batch file depending on how you set it up. If there are still errors comment here and i will try and help:
alias grun='java org.antlr.v4.gui.TestRig'
if you still have any errors after updating your setup alias then leave a comment and i will try to help further.
Setup TestRig - Added here so content is not lost after the documentation section is shut down.
ANTLR contains a testing tool in its runtime library, this tool can be used to display information detailing how the parsing is performed to match input against defined rules in your grammar file.
To use this tool contained within the ANTLR jar file you should setup your systems classpath to allow access to both the ANTLR tool and the runtime library :
export CLASSPATH=".:/usr/local/lib/antlr-4.5.3-complete.jar:$CLASSPATH"
Note: Ensure the Dot precedes any path to ensure the java virtual machine wont see classes in your current working directory.
Alises can be used on Linux/MAC/Unix to simplify commands used:
alias antlr4='java -jar /usr/local/lib/antlr-4.5.3-complete.jar'
//or any directory where your jar is located
Note setup on windows for aliases and classpath setup may be more complicated, see here for more comprehensive details.
Accessing TestRig
Once you have setup your alias you can setup TestRig in the following way, again using an alias is recommended as reduces the amount of time required to perform the action:
alias grun='java org.v4.runtime.misc.TestRig'
If you do not wish to setup an alias on windows you can access TestRig by running the following command in the same location as your ANTLR jar directory:
java -cp .;antlr.4.5.3-complete.jar org.antlrv4.runtime.misc.TestRig
//or
java -cp .;antlr.4.5.3-complete.jar org.antlrv4.gui.TestRig
To run TestRig on your grammar you can pass the parameters in for your grammar like this :
grun yourGrammar yourRule -tree //using the setup alias java -cp .;antlr.4.5.3-complete.jar org.antlrv4.gui.TestRig yourGrammar YourRule -tree //on windows with no alias java -cp .;antlr.4.5.3-complete.jar org.antlrv4.gui.TestRig yourGrammar Hello r -tree //Windows with the grammar Hello.g4 starting from the rule 'r'.
grun yourGrammar yourRule -tree //using the setup alias
java -cp .;antlr.4.5.3-complete.jar org.antlrv4.gui.TestRig yourGrammar YourRule -tree //on windows with no alias
java -cp .;antlr.4.5.3-complete.jar org.antlrv4.gui.TestRig yourGrammar Hello r -tree
//Windows with the grammar Hello.g4 starting from the rule 'r'.
Related
I am trying to execute this
java -cp .\antlr-4.7.2-complete.jar org.antlr.v4.gui.TestRig CPP14 translationUnit -gui example.cc
command but it showing this error
Can't load CPP14 as lexer or parser
You should make sure that:
the classes CPP14Lexer.java and CPP14Parser.java are generated
the generated CPP14Lexer.java and CPP14Parser.java are compiled
the compiled CPP14Lexer and CPP14Parser classes are added to the classpath
So, assuming CPP14Lexer and CPP14Parser are in the default package (and reside in the same folder as the antlr-4.7.2-complete.jar file), then your command should look like this:
java -cp .\antlr-4.7.2-complete.jar;. org.antlr.v4.gui.TestRig CPP14 translationUnit -gui example.cc
We can able to configure -Dweblogic.Stdout and -Dweblogic.StdErr params in weblogic configuration to print logs
Windows platform :
set SAVE_JAVA_OPTIONS=%JAVA_OPTIONS% -Xms8192m -Xmx10240m
-XX:MaxPermSize=4096m -Djavax.xml.soap.MessageFactory=com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl
-Dweblogic.Stdout="D:\ims_ecs\bea10_36\user_projects\domains\Domainname\logs\SystemOut.txt"
-Dweblogic.Stderr="D:\ims_ecs\bea10_36\user_projects\domains\Domainname\logs\SystemErr.txt"
-Dweblogic.slc=true -Dweblogic.debug.DebugServerLifeCycle=true
Logs are printed in declared location .
Linux platform :
set SAVE_JAVA_OPTIONS=%JAVA_OPTIONS% -Xms512m -Xmx1024m
-XX:MaxPermSize=512m -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv6Addresses=false -Djavax.xml.parsers.SAXParserFactory=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
-Dweblogic.Stdout=/u01/app/oracle/product/ofm12.1.2/user_projects/domains/Domainname/logs/SystemOut.txt
-Dweblogic.Stderr=/u01/app/oracle/product/ofm12.1.2/user_projects/domains/Domainname/logs/SystemErr.txt
Able to start weblogic but logs not printed in Required location
Can you please suggest how to get weblogic domain logs in linux
Windows and Linux have different nomenclature for their scripts.
Check startWebLogic.sh from WLS installation:
${VARIABLE_NAME} instead %VARIABLE_NAME%
: instead ;
etc.
Snippet code from it:
JAVA_OPTIONS="${JAVA_OPTIONS} -Dweblogic.management.password=${WLS_PW}"
...
...
${JAVA_HOME}/bin/java ${JAVA_VM} ${MEM_ARGS} -Dweblogic.Name=${SERVER_NAME} -Djava.security.policy=${WLS_POLICY_FILE} ${JAVA_OPTIONS} ${PROXY_SETTINGS} ${SERVER_CLASS}
Thanks Devwebcl. Instead of % symbol need to use {} in linux
then logs get printed .
used command in linux :
SAVE_JAVA_OPTIONS=%JAVA_OPTIONS% -Djavax.xml.soap.MessageFactory=com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl -Dweblogic.Stdout="/u01/app/oracle/product/ofm12.1.2/user_projects/domains/domainname/logs/SystemOut.txt" -Dweblogic.Stderr="/u01/app/oracle/product/ofm12.1.2/user_projects/domains/domainname/logs/SystemErr.txt"-Dweblogic.slc=true -Dweblogic.debug.DebugServerLifeCycle=true -Dweblogic.log.RedirectstdoutToServerLogEnabled=true
$ tclsh
% set ns [new Simulator]
invalid command name "new"
I started today with NS2.
I'm running on Cygwin.
How to overcome this error.
I mostly think the error is due to the absence of this command
"#! /usr/home/homedir/very/long/path/tclsh"
But i dont know what this path corresponds in my system.
tclsh is a component from tcl. The ns2 tclsh is e.g. tclsh8.5, and is required for running the executable ns. Ns2 "speaks" otcl, not plain tcl.
The ns2 interpreter is ns, not tclsh (tclsh8.5). Running simulations is as simple as # ns simulation-file.tcl. The executable ns knows the command set ns [new Simulator]. The tclsh* doesn't.
Examples : See ns-2.xx/tcl/ex/*, and "all ~3,000 examples" https://drive.google.com/drive/folders/0B7S255p3kFXNSmRYb2lGcDRUdWs?usp=sharing
There are no examples with the ns2 versions from this century (AFAIK) which can run commands from the % prompt, to create any results.
Creating a basic simulation : Write a file.tcl or edit a current example, or generate files.tcl with e.g. NSG2.1.jar https://ns2blogger.blogspot.dk/2014/04/nsg-21-tcl-script-generator.html → # java -jar NSG2.1.jar
Introduction to "create simulations" : https://www.isi.edu/nsnam/ns/tutorial/nsscript1.html#first
i want to use the nndep in CoreNLP for dependency Parsing. So the Input is a simple german sentence and the output should be like this:
case(Schulen-3, An-1)
amod(Schulen-3, Stuttgarter-2)
nmod(gegrüßt-13, Schulen-3)
aux(gegrüßt-13, darf-4)
case(MitschülerInnen-7, wegen-5)
amod(MitschülerInnen-7, muslimischer-6)
nmod(gegrüßt-13, MitschülerInnen-7)
neg(gegrüßt-13, nicht-8)
advmod(nicht-8, mehr-9)
case(Gott-12, mit-10)
amod(Gott-12, Grüß-11)
nmod(gegrüßt-13, Gott-12)
root(ROOT-0, gegrüßt-13)
auxpass(gegrüßt-13, werden-14)
punct(gegrüßt-13, .-15)
and this command is working for a single file:
java -cp "*" -Xmx2g edu.stanford.nlp.parser.nndep.DependencyParser -model edu/stanford/nlp/models/parser/nndep/UD_German.gz -textFile /Users/.../input.txt
But I need to to this with 60.000 files. So i need the nlp.pipeline. If i execute the following command, the output is only the normal parse tree but not the parsed dependencies.
java -Xmx6g -cp "*:." -Xmx2g edu.stanford.nlp.pipeline.StanfordCoreNLP -filelist /Users/.../filelist.txt -props StanfordCoreNLP-german.properties -outputFormat text -parse.originalDependencies
Can someone help?
You need to add
-annotators tokenize,ssplit,pos,lemma,parse,depparse
and
-pos.model edu/stanford/nlp/models/pos-tagger/german/german-ud.tagger
The first addition is telling it to use the dependency parser, the second is telling it to use the UD POS tagger, which is necessary since the dependency parser expects UD POS tags.
Also make sure to use the latest Stanford CoreNLP from GitHub or the last released version (more stable) from here:
https://stanfordnlp.github.io/CoreNLP/download.html
I'm trying to convert JSCover to cobertura xml.
Based on what i've read the command is as follows:
java -cp JSCover-all.jar jscover.report.Main --format=COBERTURAXML REPORT-DIR SRC-DIRECTORY
But I get an error
"Error: Could not find or load main class jscover.report.Main"
Even if I set the fully qualified path of there the JSCover-all.jar is located.
So I tried including the JSCover-al.jar into the classpath and run the following command instead:
java -cp jscover.report.Main --format=COBERTURAXML target/local-storage-proxy target/local-storage-proxy/original-src
I no longer get the first error but i'm now getting the following error:
Unrecognized option: --format=COBERTURAXML
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
I hope someone could help me with it. Many thanks!
The first attempt is the correct approach. The error means that JSCover-all.jar is not in the same directory that you are executing the command from. An absolute path to is not needed - a relative one will do.
In the second approach, you have passed 'jscover.report.Main' as the class-path to the JVM and '--format=COBERTURAXML' as parameter to the 'java' command.