Need help with building C# example in ANTLR 2.7 - java

I need to build the CSHARP V1 example which comes with ANTLR v 2.7.7.
Command:
D:\Comp\antlr\examples\csharp\csharp_v1>nant
I am getting the following output:
D:\Comp\antlr\examples\csharp\csharp_v1>D:\Comp\nant\bin\nant
NAnt 0.85 (Build 0.85.2478.0; release; 10/14/2006)
Copyright (C) 2001-2006 Gerry Shaw
http://nant.sourceforge.net
Buildfile: file:///D:/Comp/antlr/examples/csharp/csharp_v1/csharp_v1.build
Target framework: Microsoft .NET Framework 2.0
Target(s) specified: test
[tstamp] Monday, May 11, 2009 11:21:20 PM.
[echo] Building project: 'CSharp v1 Grammar Sample for ANTLR' generate:
[exec] java.lang.NoClassDefFoundError: antlr/Tool
[exec] Caused by: java.lang.ClassNotFoundException: antlr.Tool
[exec] at java.net.URLClassLoader$1.run(Unknown Source)
[exec] at java.security.AccessController.doPrivileged(Native Method)
[exec] at java.net.URLClassLoader.findClass(Unknown Source)
[exec] at java.lang.ClassLoader.loadClass(Unknown Source)
[exec] at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
[exec] at java.lang.ClassLoader.loadClass(Unknown Source)
[exec] at java.lang.ClassLoader.loadClassInternal(Unknown Source)
[exec] Could not find the main class: antlr.Tool. Program will exit.
[exec] Exception in thread "main"
BUILD FAILED - 0 non-fatal error(s), 11 warning(s)
D:\Comp\antlr\examples\csharp\csharp_v1\csharp_v1.build(52,10):
External Program Failed: java.exe (return code was 1)
Total time: 0.2 seconds.
I have nANT working properly for other builds.
I am not a java guy...any help would be helpful.
Kind regards,

Look in the make file csharp_v1.build.
On line 10 change it from:
<property name="antlr.dir" value="..\..\.."/>
to
<property name="antlr.dir" value="..\..\..\antlr.jar"/>

Related

can not running javafx project on netbeans8-2

i can not run a simple javaFx project on netbeans8-2
i am using ubuntu 18.04 LTS and openjdk
but openjfx can not install on my system (in fact it will install but files that are here [ https://packages.ubuntu.com/bionic/amd64/openjfx/filelist ] will not exist at their place)
for example file jfxrt.jar was not exist in the /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/ directory
so i copy this file with sudo cp command
but i can not find two files that their names are javafxpackager.1.gz and javapackager.1.gz on my system and internet
and so on the errors are this when i run my program
run:
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: java.lang.UnsatisfiedLinkError: com.sun.glass.ui.gtk.GtkApplication._isDisplayValid()Z
at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:267)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:211)
at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:675)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:337)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
... 5 more
Caused by: java.lang.UnsatisfiedLinkError: com.sun.glass.ui.gtk.GtkApplication._isDisplayValid()Z
at com.sun.glass.ui.gtk.GtkApplication._isDisplayValid(Native Method)
at com.sun.glass.ui.gtk.GtkApplication.isDisplayValid(GtkApplication.java:83)
at com.sun.glass.ui.gtk.GtkApplication.<init>(GtkApplication.java:67)
at com.sun.glass.ui.gtk.GtkPlatformFactory.createApplication(GtkPlatformFactory.java:41)
at com.sun.glass.ui.Application.run(Application.java:146)
at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:257)
... 9 more
/home/*/.cache/netbeans/8.2/executor-snippets/run.xml:53: Java returned: 1
BUILD FAILED (total time: 3 seconds)
that link refers to
<java classpath="${classpath}" classname="${classname}" dir="${work.dir}" jvm="${platform.java}" fork="true" failonerror="${java.failonerror}">
is my problem related to openjfx?

griffon lazybones cannot create griffon-swing-groovy project

I am following this guide Griffon Guide 2.12
I am stuck at 2.2.1. Creating a Project in the line
$ lazybones create griffon-swing-groovy console
I get the following errors:
lazybones create griffon-swing-groovy console ~
Creating project from template griffon-swing-groovy (latest) in 'console'
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read1(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at org.codehaus.groovy.runtime.ResourceGroovyMethods.configuredInputStream(ResourceGroovyMethods.java:1978)
at org.codehaus.groovy.runtime.ResourceGroovyMethods.newInputStream(ResourceGroovyMethods.java:1991)
at org.codehaus.groovy.runtime.ResourceGroovyMethods.withInputStream(ResourceGroovyMethods.java:1657)
at uk.co.cacoethes.lazybones.commands.PackageDownloader$_downloadPackage_closure1.doCall(PackageDownloader.groovy:33)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:292)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
at groovy.lang.Closure.call(Closure.java:423)
at groovy.lang.Closure.call(Closure.java:439)
at org.codehaus.groovy.runtime.IOGroovyMethods.withStream(IOGroovyMethods.java:1316)
at org.codehaus.groovy.runtime.ResourceGroovyMethods.withOutputStream(ResourceGroovyMethods.java:1627)
at uk.co.cacoethes.lazybones.commands.PackageDownloader.downloadPackage(PackageDownloader.groovy:32)
at uk.co.cacoethes.lazybones.commands.PackageDownloader$downloadPackage.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:110)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:138)
at uk.co.cacoethes.lazybones.commands.CreateCommand.doExecute(CreateCommand.groovy:89)
at uk.co.cacoethes.lazybones.commands.AbstractCommand.execute(AbstractCommand.groovy:30)
at uk.co.cacoethes.lazybones.LazybonesMain.main(LazybonesMain.groovy:89)
I am using the following environment for developing
Windows 7 Ultimate
Babun shell
SDK version SDKMAN 5.5.12+269
Lazybones
lazybones list ~
Available templates in griffon/griffon-lazybones-templates
griffon-javafx-groovy
griffon-javafx-java
griffon-javafx-kotlin
griffon-lanterna-groovy
griffon-lanterna-java
griffon-pivot-groovy
griffon-pivot-java
griffon-plugin
griffon-swing-groovy
griffon-swing-java
Gradle
gradle -v
Gradle 4.3
Build time: 2017-10-30 15:43:29 UTC Revision:c684c202534c4138b51033b52d871939b8d38d72
Groovy:2.4.12
Ant:Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM:1.8.0_144 (Oracle Corporation 25.144-b01)
OS:Windows 7 6.1 x86
I downloaded the templates manually also
The following are available in .lazybones/templates
griffon-javafx-groovy-template-1.9.1
griffon-javafx-java-template-1.9.1
griffon-plugin-template-1.9.1
griffon-swing-groovy-template-1.9.1
griffon-swing-java-template-1.9.1
I am still unable to create any project using lazybones.I am not able to understand the problem that I am getting.
Thanks in advance,
Vanlal
That's odd, I can successfully create an application using the latest versions of all tools, starting from scratch as witnessed by
[tmp]> ls -l ~/.lazybones/templates/
[tmp]> lazybones --version
Lazybones version 0.8.3
[tmp]> gradle --version
------------------------------------------------------------
Gradle 4.3
------------------------------------------------------------
Build time: 2017-10-30 15:43:29 UTC
Revision: c684c202534c4138b51033b52d871939b8d38d72
Groovy: 2.4.12
Ant: Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM: 1.8.0_144 (Oracle Corporation 25.144-b01)
OS: Mac OS X 10.12.5 x86_64
[tmp]> lazybones create griffon-swing-groovy sample
Creating project from template griffon-swing-groovy (latest) in 'sample'
Define value for 'group' [org.example]:
... snip snip ...
Project created in sample!
[tmp]> ls -l ~/.lazybones/templates/
total 1024
-rw-r--r--+ 1 aalmiray staff 510K Oct 31 18:28 griffon-swing-groovy-1.12.0.zip
[tmp]>
It's worth mentioning that the latest version of the griffon-swing-groovy template is 1.12.0. You may specify a version number when creating the application, such as
lazybones create griffon-swing-groovy 1.12.0 sample

java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory even my class did have the jars

This took me some time to debug , but still no clue.
I am using m2e under Eclipse, I checked the java.class.path, it did have below jars on the classpath.
Any idea ?
Exception in thread "main" java.lang.NoClassDefFoundError:
org/slf4j/LoggerFactory
at hadoop.ReadHDFS.main(ReadHDFS.java:18)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 1 more
C:\Users\xxxx\.m2\repository\org\slf4j\slf4j-api\1.7.10\slf4j-api-1.7.10.jar
C:\Users\xxxx\.m2\repository\log4j\log4j\1.2.17\log4j-1.2.17.jar
C:\Users\xxxx\.m2\repository\org\slf4j\slf4j-log4j12\1.7.10\slf4j-log4j12-1.7.10.jar
---add more context---
I am running the hadoop program. just found that when i add the hadoop-client dependency in the pom.xml, it will abort this error .
In the pom.xml , i did not explicitly add these dependencies but the effective pom have them and the java.class.path also include them.
Compile is good and only error in runtime
---workaround---
It will work if i excluded the slf4j-api from hadoop-client :
As for the root cause, still unknown.

Windows Service - Apache commons daemon class not found

I have a Jar file that needs to be installed as a windows service. I'm using Apache commons daemon procrun.
Though the service appears in the Services tab in task manager its not running. Its in stopped state and attempting to start it seems not working.
*In commons daemons logs I noticed that it cannot load the main class which is the "AgentApp".
I installed 32bit jre too.
Mentioned here under the log file contents.
imageprocagent stderr:
2015-01-07 15:47:47 Commons Daemon procrun stderr initialized
java.lang.NoClassDefFoundError: org/apache/commons/daemon/Daemon
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.daemon.Daemon
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 12 more
Exception in thread "main"
crawford-daemon:
[2015-01-07 15:47:47] [info] Commons Daemon procrun (1.0.10.0 32-bit) started
[2015-01-07 15:47:47] [info] Running 'ImageProcAgent' Service...
[2015-01-07 15:47:47] [info] Starting service...
[2015-01-07 15:47:49] [error] FindClass com/fx358/fx9/agent/AgentApp failed
[2015-01-07 15:47:49] [error] Failed to start Java
[2015-01-07 15:47:49] [error] ServiceStart returned 4
[2015-01-07 15:47:49] [info] Run service finished.
[2015-01-07 15:47:49] [info] Commons Daemon procrun finished
`[2015-01-07 15:47:49] [error] FindClass com/fx358/fx9/agent/AgentApp failed
Here is the script I'm using to install the agent:
SET DISPLAYNAME="ImageProcAgent"
SET DESCRIPTION="FX9 image processing Agent"
SET LOGPATH="C:\FX9\logs\ImageProcAgent"
SET STARTPATH=
SET JVMLOCATION="C:\Program Files (x86)\Java\jre7\bin\client\jvm.dll"
SET CUSTCLASSPATH="C:\FX9\release\ImageProcAgent\GenericAgent_jar\GenericAgent.jar;C:\FX9\release\ImageProcAgent\GenericAgent_jar\ImageProcAgent.jar;."
ECHO ON
ImageProcAgent.exe //IS//ImageProcAgent --DisplayName=%DISPLAYNAME% --Description=%DESCRIPTION% --Startup=auto --LogPath=%LOGPATH% --LogLevel=INFO --LogPrefix=crawford-daemon --StdOutput=auto --StdError=auto --StartPath=%STARTPATH% --StartClass=com.fx358.fx9.agent.AgentApp --StartMethod=main --StartParams=start --StartMode=jvm --StopPath=%% --StopClass=com.fx358.fx9.agent.AgentApp --StopMethod=stop --StopMode=jvm --Jvm=%JVMLOCATION% --Classpath=%CUSTCLASSPATH% --JvmOptions=-Xmx512M ++JvmOptions=-Djava.util.logging.config.file=logging.properties
`
Can someone point me out what I'm doing wrong? thanks in advance.
I had the same error. Turns out, I was attempting to use commons-logging and log4j directly within the Service class. However, the log4j was not initializing properly, thus causing the load to error out.
I removed all the log4j, replacing it with a simple System.out.* and it worked.
In your classpath declaration there are only 2 jar entries:
CUSTCLASSPATH="C:\FX9\release\ImageProcAgent\GenericAgent_jar\GenericAgent.jar;C:\FX9\release\ImageProcAgent\GenericAgent_jar\ImageProcAgent.jar;."
Is your application's your build as a fat-jar containing all compile and runtime dependencies? Otherwise you'll have to add each JAR that is needed at runtime of your service to the classpath. For example:
CUSTCLASSPATH="C:\FX9\release\ImageProcAgent\GenericAgent_jar\GenericAgent.jar;C:\FX9\release\ImageProcAgent\GenericAgent_jar\ImageProcAgent.jar;C:\FX9\release\ImageProcAgent\GenericAgent_jar\lib\commons-daemon-1.0.15.jar;<PROBABLY_MORE_JARS_NEED_TO_BE_ADDED_HERE>;."
Furthermore using . in the classpath of your service is probably not a good idea. You should only use fully qualified paths in there. Otherwise you'll be dependent on the location from where the service is executed by Windows.
I had the same error with a runnable jar build with ANT. The Service-Class fails with a severe error. One reason was, i used signed libraries SHA1-Digest, please check this. To avoid this problem don't build a runnable, deliver the libraries you are using, and set the Class-Path in the MANIFEST.MF of your JAR-File. Hope this helps you.

Axis2 : XmlSchema class not found

I'm trying to generate Java classes with WSDL2Java. I run the simplest example and get errors.
$ jar tvf XmlSchema-1.4.7.jar | grep org/apache/ws/commons/schema/XmlSchema.class
14803 Wed Sep 22 17:28:44 CEST 2010 org/apache/ws/commons/schema/XmlSchema.class
$ ./bin/wsdl2java.sh -classpath $(echo lib/*.jar | tr ' ' ';') -uri HelloWorld.wsdl
Using AXIS2_HOME: /C/Documents and Settings/ixos/axis2-1.6.2
Using JAVA_HOME: /C/Program Files/Java/jdk1.7.0_07/
Retrieving document at 'samples/wsdl/Axis2SampleDocLit.wsdl'.
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/ws/commons/schema/XmlSchema
at org.apache.axis2.description.WSDLToAxisServiceBuilder.<init>(WSDLToAxisServiceBuilder.java:103)
at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.<init>(WSDL11ToAxisServiceBuilder.java:226)
at org.apache.axis2.description.WSDL11ToAllAxisServicesBuilder.<init>(WSDL11ToAllAxisServicesBuilder.java:63)
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:166)
at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
Caused by: java.lang.ClassNotFoundException: org.apache.ws.commons.schema.XmlSchema
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 6 more
The libraries are in the path and now I'm stuck and don't know to do next. Google isn't helpful at all ...
CLASSPATH
lib/XmlSchema-1.4.7.jar;lib/activation-1.1.jar;lib/antlr-2.7.7.jar;lib/apache-mime4j-core-0.7.2.jar;lib/axiom-api-1.2.13.jar;lib/axiom-dom-1.2.13.jar;lib/axiom-
impl-1.2.13.jar;lib/axis2-adb-1.6.2.jar;lib/axis2-adb-codegen-1.6.2.jar;lib/axis2-ant-plugin-1.6.2.jar;lib/axis2-clustering-1.6.2.jar;lib/axis2-codegen-1.6.2.ja
r;lib/axis2-corba-1.6.2.jar;lib/axis2-fastinfoset-1.6.2.jar;lib/axis2-java2wsdl-1.6.2.jar;lib/axis2-jaxbri-1.6.2.jar;lib/axis2-jaxws-1.6.2.jar;lib/axis2-jibx-1.
6.2.jar;lib/axis2-json-1.6.2.jar;lib/axis2-kernel-1.6.2.jar;lib/axis2-metadata-1.6.2.jar;lib/axis2-mtompolicy-1.6.2.jar;lib/axis2-saaj-1.6.2.jar;lib/axis2-soapm
onitor-servlet-1.6.2.jar;lib/axis2-spring-1.6.2.jar;lib/axis2-transport-http-1.6.2.jar;lib/axis2-transport-local-1.6.2.jar;lib/axis2-xmlbeans-1.6.2.jar;lib/bcel
-5.1.jar;lib/commons-cli-1.2.jar;lib/commons-codec-1.3.jar;lib/commons-fileupload-1.2.jar;lib/commons-httpclient-3.1.jar;lib/commons-io-1.4.jar;lib/commons-logg
ing-1.1.1.jar;lib/geronimo-annotation_1.0_spec-1.1.jar;lib/geronimo-jaxws_2.2_spec-1.0.jar;lib/geronimo-jta_1.1_spec-1.1.jar;lib/geronimo-saaj_1.3_spec-1.0.1.ja
r;lib/geronimo-stax-api_1.0_spec-1.0.1.jar;lib/geronimo-ws-metadata_2.0_spec-1.1.2.jar;lib/httpcore-4.0.jar;lib/jalopy-1.5rc3.jar;lib/jaxb-api-2.1.jar;lib/jaxb-
impl-2.1.7.jar;lib/jaxb-xjc-2.1.7.jar;lib/jaxen-1.1.1.jar;lib/jaxws-tools-2.1.3.jar;lib/jettison-1.0-RC2.jar;lib/jibx-bind-1.2.jar;lib/jibx-run-1.2.jar;lib/jsr3
11-api-1.0.jar;lib/juli-6.0.16.jar;lib/log4j-1.2.15.jar;lib/mail-1.4.jar;lib/mex-1.6.2-impl.jar;lib/neethi-3.0.2.jar;lib/regexp-1.2.jar;lib/tribes-6.0.16.jar;li
b/woden-api-1.0M9.jar;lib/woden-impl-commons-1.0M9.jar;lib/woden-impl-dom-1.0M9.jar;lib/wsdl4j-1.6.2.jar;lib/wstx-asl-3.2.9.jar;lib/xalan-2.7.0.jar;lib/xml-reso
lver-1.2.jar;lib/xmlbeans-2.3.0.jar
The problem is with your jdk (1.7): axis2 doesn't get along with it. Download the jdk 1.6 library and link it in your eclipse, then re-try.

Categories