在cmd中编译java文件时出错

时间:2018-03-21 20:29:26

标签: java cmd antlr4

我不确定为什么但是在尝试使用javac MyCompiler.java在cmd中运行我的java文件时遇到错误。当我从Intellij运行它时,该文件运行正常。我已将C:\Program Files\Java\jdk1.8.0_144\bin添加到类路径。

我得到的错误:

MyCompiler.java:4: error: package org.antlr.v4.gui does not exist
import org.antlr.v4.gui.TreeViewer;
                   ^
MyCompiler.java:5: error: package org.antlr.v4.runtime.tree does not exist
import org.antlr.v4.runtime.tree.*;
^
MyCompiler.java:6: error: package org.antlr.v4.runtime does not exist
import org.antlr.v4.runtime.*;
^
.\CompilerBaseVisitor.java:2: error: package org.antlr.v4.runtime.tree does 
not exist
import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor;
                            ^
.\CompilerBaseVisitor.java:12: error: cannot find symbol
public class CompilerBaseVisitor<T> extends AbstractParseTreeVisitor<T> 
implements CompilerVisitor<T> {
                                        ^
symbol: class AbstractParseTreeVisitor
.\CompilerVisitor.java:2: error: package org.antlr.v4.runtime.tree does not 
exist
import org.antlr.v4.runtime.tree.ParseTreeVisitor;
                            ^
.\CompilerVisitor.java:11: error: cannot find symbol
public interface CompilerVisitor<T> extends ParseTreeVisitor<T> {
                                        ^
symbol: class ParseTreeVisitor
.\CompilerParser.java:2: error: package org.antlr.v4.runtime.atn does not 
exist
import org.antlr.v4.runtime.atn.*;
^
.\CompilerParser.java:3: error: package org.antlr.v4.runtime.dfa does not 
exist
import org.antlr.v4.runtime.dfa.DFA;
                           ^
.\CompilerParser.java:4: error: package org.antlr.v4.runtime does not exist
import org.antlr.v4.runtime.*;
^
.\CompilerParser.java:5: error: package org.antlr.v4.runtime.misc does not 
exist
import org.antlr.v4.runtime.misc.*;
^
.\CompilerParser.java:6: error: package org.antlr.v4.runtime.tree does not 
exist
import org.antlr.v4.runtime.tree.*;

该错误似乎与ANTLR相关,但我不确定如何解决它。任何帮助将不胜感激。

0 个答案:

没有答案