1

As part of my study, I am using the JavaCC Eclipse plug-in to create a lexical analysis and parser a parser for a programming language. The parser is generated succesfully and when I run the generated Java code in Eclipse, it is working perfectly.

However, to easily pass a text file to parse, I would like to run the program from command line. When doing so using java Adder with Adder being the name of my main file, I am getting the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: Adder
Caused by: java.lang.ClassNotFoundException: Adder
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

Can anyone tell me how to fix this error? I have read that I might have to modify my path but I am unsure what to add to the path.

simonbs
  • 7,932
  • 13
  • 69
  • 115

1 Answers1

0

At runtime JVM is not able to find the class in classpath. Please make sure that you include java class in system classpath

navyad
  • 3,752
  • 7
  • 47
  • 88