Javacc run error

Hi i have started using javacc
I have compliled the simple1.jj file using javacc and it built everything successfully, when i javac everything they alll seem to compile.
But then when i java Simple1
it says..... can anybody help me fix this. I'am usinsing LINUX suse 11.0 ... but had the same problem in windows

Exception in thread "main" java.lang.NoClassDefFoundError: Simple1
Caused by: java.lang.ClassNotFoundException: Simple1
      at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
pablo25Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

szigetiCommented:
Hi, try this:

java -classpath . Simple1

You need to add the current directory to the classpath.
0
szigetiCommented:
Or if the file is in a package, e.g. /use/some/package/Simple1.class, then go to /user and run it from there:

java -classpath . some.package.Simple1    (notice the "." indicating current directory).
0
pablo25Author Commented:
no thants not working i have java installed trough yast on suse
I tried those commands and to no avail.
the file is at my home directory as is the command and the java commands java javac javacc all work at this llocation
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

szigetiCommented:
Do you mean the java command is not working? if java is not on your path, then you have to use the commands with absolute path, e.g.:

Assume file is in:
/home/user/Simple1.class

Then:

cd /home/user
/usr/java/bin/java -classpath . Simple1
0
szigetiCommented:
type this to find out where java is located:

which java
0
pablo25Author Commented:
its at /usr/bin/java
0
pablo25Author Commented:

Thi sis what i got

linux-mzqf:/home # /usr/bin/java -classpath . Simple1
Exception in thread "main" java.lang.NoClassDefFoundError: Simple1
Caused by: java.lang.ClassNotFoundException: Simple1
      at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
linux-mzqf:/home #

0
szigetiCommented:
Ok, then the class Simple1 must be in a package.

1. Open the Simple1.java source, look for the package x.y.z; declaration
2. Go to where your file is. If the file is already under /home/x/y/z/Simple1.class, then proceed to step 4
3. Create /home/x/y/z, move Simple1.class to /home/x/y/z
4. Go to /home
5. /usr/bin/java -classpath . x.y.z.Simple1

* Please make sure to substitite "x.y.z" and directories "x/y/z" with the package name you found in the source!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
szigetiCommented:
Btw. if you don't see Simple1.class *anywhere*, then your build was not successful.
0
pablo25Author Commented:
Thanks!!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.