Could not find main class javacc

简介:

最近在搞JavaCC,也一直跟着Eclipse 3.6的测试版不断更新Eclipse。遇到如下问题:

现象:

  JavaCC Eclipse Plugin中的JavaCC Console中显示:

>java -classpath D:/software/Develop/IDE/eclipse3.6RC1/plugins/sf.eclipse.javacc_1.5.22/javacc.jar javacc PlSql.jj Error: Could not find main class javacc java.lang.NoClassDefFoundError: javacc at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:198) Caused by: java.lang.ClassNotFoundException: javacc at java.net.URLClassLoader$1.run(URLClassLoader.java:299) at java.net.URLClassLoader$1.run(URLClassLoader.java:288) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:287) at java.lang.ClassLoader.loadClass(ClassLoader.java:422) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:325) at java.lang.ClassLoader.loadClass(ClassLoader.java:355) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:195) Exception in thread "main"

解决方案:

  到workspace的项目根目录下,打开.settings/sf.eclipse.javacc.prefs,修改RUNTIME_JJJAR和RUNTIME_JTBJAR两个属性的值,设置为正确的路径即可。

说明:

  JavaCC Eclipse Plugin把命令行的classpath路径设置到了项目路径中,更改eclipse目录的话,路径不会自动更新,还是会指向老的目录,在.setting里存在和本地环境有关的属性是一个不好的设计。

 

目录
相关文章
|
Java Maven Spring
|
7月前
Could not find method debug()
Could not find method debug()
256 59
为什么要写 __name__ == “__main__”
if __name__ == "__main__" 模式在Python中用于区分模块是被直接运行还是被导入。通过这种模式,可以编写既可以作为独立脚本运行又可以作为模块导入的代码,从而提高代码的重用性和可维护性。
|
5月前
|
Python
Cannot find reference ‘args‘ in ‘__init__.pyi‘ ,request要写对
Cannot find reference ‘args‘ in ‘__init__.pyi‘ ,request要写对
|
索引
string.find
string.find
139 0
|
C++
C++ string.find()函数
C++ string.find()函数
165 0
【Junit 报错】Test class should have exactly one public zero-argument constructor和Test class can only have one constructor
错误1: 1 java.lang.Exception: Test class should have exactly one public zero-argument constructor 2 at org.
6160 0