I downloaded the demo from http://www2.cs.tum.edu/projects/cup/
I got parser.java by command:
java -jar bin/java-cup-11a.jar cup/parser.cup
but when I compile parser.java by:
javac -classpath lib/java-cup-11a-runtime.jar parser.java
the result is:
cspro#Think:~/Desktop/template$ javac -classpath lib/*.jar -d . parser.java
parser.java:104: cannot find symbol
symbol : class Parser
location: class Example.parser
if (args.length==0) new Parser(new Scanner(System.in,sf),sf).parse();
^
parser.java:104: java_cup.runtime.Scanner is abstract; cannot be instantiated
if (args.length==0) new Parser(new Scanner(System.in,sf),sf).parse();
^
parser.java:105: cannot find symbol
symbol : class Parser
location: class Example.parser
else new Parser(new Scanner(new java.io.FileInputStream(args[0]),sf),sf).parse();
^
parser.java:105: java_cup.runtime.Scanner is abstract; cannot be instantiated
else new Parser(new Scanner(new java.io.FileInputStream(args[0]),sf),sf).parse();
^
Note: parser.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
4 errors
how to compile the parser.java ?
Related
I'm quite new to gauge and have problems running a set of gauge tests. When I try to gauge run I get the following console output:
src\main\java\de\...\qa\Common.java:3: error: package com.github.....gauge.graphql does not exist
import com.github.....gauge.graphql.GraphqlSetup;
^
symbol: class VariableStorage
location: class Pricing
src\main\java\de\...\qa\testcraft\GaugeTestCraft.java:3: error: package com.github.....gauge.random.data does not exist
import com.github.....gauge.random.data.VariableStorage;
^
src\main\java\de\...\qa\testcraft\TestCraftExecutor.java:4: error: package org.tinylog does not exist
import org.tinylog.Logger;
^
src\test\java\de\...\qa\PricingTest.java:8: error: package org.junit.jupiter.api does not exist
import org.junit.jupiter.api.Test;
^
src\test\java\de\...\qa\PricingTest.java:9: error: package org.yaml.snakeyaml does not exist
import org.yaml.snakeyaml.Yaml;
^
src\test\java\de\...\qa\TestVariableStorage.java:3: error: package com.github.....gauge.random.data does not exist
import com.github.....gauge.random.data.VariableStorage;
^
src\test\java\de\...\qa\TestVariableStorage.java:9: error: cannot find symbol
public class TestVariableStorage implements VariableStorage {
^
symbol: class VariableStorage
src\test\java\de\...\qa\PricingTest.java:26: error: cannot find symbol
#Test
^
symbol: class Test
location: class PricingTest
src\test\java\de\...\qa\PricingTest.java:33: error: cannot find symbol
#Test
^
symbol: variable Logger
location: class TestCraftExecutor
src\test\java\de\...\qa\TestVariableStorage.java:12: error: method does not override or implement a method from a supertype
#Override
^
src\test\java\de\...\qa\TestVariableStorage.java:17: error: method does not override or implement a method from a supertype
#Override
^
src\test\java\de\...\qa\TestVariableStorage.java:22: error: method does not override or implement a method from a supertype
#Override
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
55 errors
Error occurred while waiting for runner process to finish.
Error : exit status 1
Error ----------------------------------
[Gauge]
Failed to start gauge API: Error occurred while waiting for runner process to finish.
Error : exit status 1
Get Support ----------------------------
Docs: https://docs.gauge.org
Bugs: https://github.com/getgauge/gauge/issues
Chat: https://spectrum.chat/gauge
Your Environment Information -----------
windows, 1.1.1, 6e0d83f
html-report (4.0.12), java (0.7.9), python (0.3.11), screenshot (0.0.1), xml-report (0.2.3)
Does someone know how this happens and how to solve it? Here are some additional informations:
Java version:14.0.2
Gauge version: 1.1.1
Maven version: 3.6.3
I just resolve the problem.
You should check your project's gauge.log. The Traceback is in the file, that will help you.
Don`t see the output, it will not work.
I am getting this error while smartbuilding my module named in.pispl.bankslipmodue and java package name in.pispl.bankslipmodule.ad_actionButton and class named ManualProcessActionHandler:
/opt/OpenbravoERP-3.0/openbravo-erp/srcAD/org/openbravo/erpCommon/ad_actionButton/ActionButtonJava_Responser.java:5294: cannot find symbol
[javac] symbol : method execute(org.openbravo.scheduling.ProcessBundle)
[javac] location: class in.pispl.bankslipmodule.ad_actionButton.ManualProcessActionHandler
[javac] new in.pispl.bankslipmodule.ad_actionButton.ManualProcessActionHandler().execute(pb);
I have a java applet (SetWatch.class) which I wish to modify. It only supports an offset of 30 minutes and I want 120. I'd like to parameterise the value eventually, but I'd settle for a hard code value as an interim step. I have decompiled it using the website www. showmycode. com. The class file and the resulting .java file are here:
http://www.edcint.co.nz/tmp/SetWatch/
I have programming skills but not java skills so I am unable to verify if the .java file looks good. So I before I modify it I thought I'd try and compile it.
I am running Fedora 19 and using java-1.7.0-openjdk.
I try a basic
javac SetWatch.java
Which gives:
SetWatch.java:65: error: cannot find symbol
javax.sound.sampled.DataLine.Info info = new javax.sound.sampled.DataLine.Info(javax/sound/sampled/SourceDataLine, audioformat);
^
symbol: variable javax
location: class SetWatch
SetWatch.java:65: error: cannot find symbol
javax.sound.sampled.DataLine.Info info = new javax.sound.sampled.DataLine.Info(javax/sound/sampled/SourceDataLine, audioformat);
^
symbol: variable sound
location: class SetWatch
SetWatch.java:65: error: cannot find symbol
javax.sound.sampled.DataLine.Info info = new javax.sound.sampled.DataLine.Info(javax/sound/sampled/SourceDataLine, audioformat);
^
symbol: variable sampled
location: class SetWatch
SetWatch.java:65: error: cannot find symbol
javax.sound.sampled.DataLine.Info info = new javax.sound.sampled.DataLine.Info(javax/sound/sampled/SourceDataLine, audioformat);
^
symbol: variable SourceDataLine
location: class SetWatch
4 errors
So I set about trying to find javax.sound.sampled.DataLine.Info.
I find javax/sound/sampled/DataLine$Info.class inside /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.5.0.fc19.i386/jre/lib/rt.jar. Close, maybe that will work?
javac -classpath /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.5.0.fc19.i386/jre/lib/rt.jar SetWatch.java
No. Same errors. So I try unzip /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.5.0.fc19.i386/jre/lib/rt.jar into /tmp (which does seem dodgy to me) and then try
javac -classpath /tmp/javax/sound/sampled SetWatch.java which gives different errors:
SetWatch.java:674: error: cannot access AudioFormat
AudioFormat audioformat;
^
bad class file: /tmp/javax/sound/sampled/AudioFormat.class
class file contains wrong class: javax.sound.sampled.AudioFormat
Please remove or make sure it appears in the correct subdirectory of the classpath.
This looks worse to me like it has sort of worked but caused other problems.
I know I only have javax/sound/sampled/DataLine$Info.class which is not exactly what I want. Where do I get javax.sound.sampled.DataLine.Info from?
I've grepped inside every file from the java RPMs looking for DataLine\.Info but I can not find it.
This is the problem when using a decompiler, you often get junk code in the resultant "source" file. The class literal argument has been mangled:
info =
new javax.sound.sampled.DataLine.Info(javax/sound/sampled/SourceDataLine,
audioformat);
^--------------------------------^
it should be
info =
new javax.sound.sampled.DataLine.Info(javax.sound.sampled.SourceDataLine.class,
audioformat);
Read: DataLine.Info javadoc
I'm trying to compile a java code as in the following line :
javac -classpath /Users/tim/kws/code/library:/Users/moab/kws/code/commons-cli-1.2/commons-cli-1.2.jar:/Users/tim/kws/code/commons-math-2.2/commons-math-2.2.jar:/Users/tim/kws/code/common-math3-3.1.1/commons-math3-3.1.1.jar RATSWriteLandmarksFromPfile.java
/Users/tim/kws/code/library/ppm/types/LabelPfile.java:17: error: package org.apache.commons.math3.random does not exist
import org.apache.commons.math3.random.RandomDataImpl;
^
/Users/tim/kws/code/library/ppm/types/LabelPfile.java:50: error: cannot find symbol
private RandomDataImpl randomData_;
^
symbol: class RandomDataImpl
location: class LabelPfile
/Users/tim/kws/code/library/ppm/types/LabelPfile.java:321: error: cannot find symbol
randomData_ = new RandomDataImpl();
^
symbol: class RandomDataImpl
location: class LabelPfile
3 errors
does anybody know why am I getting these errors ?
Seems like you are missing the commons-math3 library.
I ran the following command to compile a servlet called BeerSelect.java from HeadFirst Servlets and JSP book.
D:\Apache Tomcat\apache-tomcat-5.5.36\apache-tomcat-5.5.36\webapps\Coffee>javac
-classpath /common/lib servlet-api.jar:classes: -d classes src/com/example/web/B
eerSelect.java
My servlet-api.jar is located in D:\Apache Tomcat\apache-tomcat-5.5.36\apache-tomcat-5.5.36\common\lib
MESSAGE
javac: invalid flag: servlet-api.jar:classes:
Usage: javac <options> <source files> use -help for a list of possible options
Cannot understand how to fix this command and compile the servlet. Doing it for the first time new to servlets.
Then I changed the command to be
D:\Apache Tomcat\apache-tomcat-5.5.36\apache-tomcat-5.5.36\webapps\Coffee\WEB-IN
F\src\com\example\web>javac -classpath "D:\Apache Tomcat\apache-tomcat-5.5.36\ap
ache-tomcat-5.5.36\common\lib\servlet-api.jar";classes BeerSelect.java
MESSAGE
BeerSelect.java:3: package com.example.model does not exist
import com.example.model.*;
^
BeerSelect.java:15: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert be = new BeerExpert();
^
BeerSelect.java:15: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert be = new BeerExpert();
^
BeerSelect.java:32: cannot find symbol
symbol : variable out
location: class com.example.web.BeerSelect
out.println("<br>try: " + it.next());
^
4 errors
Why cannot it find the com.example.model package ?
IMAGE
It looks like you have three issues with your command: extra spaces, Unix-style pathnames, and missing additional Java source files. Try the following instead:
javac -classpath "D:\Apache Tomcat\apache-tomcat-5.5.36\apache-tomcat-5.5.36\common\lib\servlet-api.jar";classes -d classes src\com\example\web\*.java src\com\example\model\*.java
I've removed extra spaces, converted Unix paths to Windows paths, changed the classpath separator from the Unix-style ':' to Windows-style ';', and added your other Java sources - compiling them all together should resolve your first three compiler errors.
As for the last compiler error, that appears to be a genuine source code error - try prepending System. to the out.println("<br>try: " + it.next()); line. (It can also be resolved by a static import, but that would be unconventional.)
D:\Apache Tomcat\apache-tomcat-5.5.36\apache-tomcat-5.5.36\webapps\Coffee>javac -classpath "D:\Apache Tomcat\apache-tomcat-5.5.36\apache-tomcat-5.5.36\common\lib\servlet-api.jar";"D:\Apache Tomcat\apache-tomcat-5.5.36\apache-tomcat-5.5.36\webapps\Coffee\WEB-INF\src" WEB-INF\src\com\example\web\BeerSelect.java
This command works and compiles the class BeerSelect.java.