antlrworks中导入数据包的问题
必须创建一个由我定义的包,其中包含一些类,我记得在我进行导入的程序 AntlrWorks 创建的文件 .java 中的包。名为“com.project.redfox”的包。我使用以下命令编译了代码:“javac Test.java provaParser.java provaLexer.java”,但出现包不存在的错误。
在语法中添加了:
grammar prova;
@hader{
import com.project.redfox;
}
....something......
我在 NetBeans 中开发的 redfox 项目中创建了包“com.project.redfox”,因此目录 com/project/redfox 位于 redfox 目录中。
我该如何解决这个问题?
Have to create a package defined by me, containing some of the classes, and I recall that package in a file .java created of the program AntlrWorks in which i did the import. Package named "com.project.redfox" . I compiled the code with the command: "javac Test.java provaParser.java provaLexer.java" but I get the error that not exist the package.
In the grammar have added :
grammar prova;
@hader{
import com.project.redfox;
}
....something......
I created the package "com.project.redfox" within of the project redfox developed in NetBeans, therefore the directory com/project/redfox is in the directory redfox.
how can I solve this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正式回答您的问题:
javac
找不到您可能在com.project.redfox
中使用的包com.wikirates
。请注意,我假设 redfox 是一个类。如果它是一个包,您需要像这样导入其中的所有类:
import com.project.redfox.*;
而不是import com.project.redfox;
(假设com.project.redfox 中有类...)。To formally answer your question:
javac
can't find the packagecom.wikirates
which you are probably using incom.project.redfox
.Note that I assumed
redfox
is a class. If it's a package, you need to import all classes from it like this:import com.project.redfox.*;
instead ofimport com.project.redfox;
(assuming that there are classes incom.project.redfox
...).