Results 1 to 4 of 4
- 12-01-2010, 01:42 AM #1
Member
- Join Date
- Dec 2010
- Posts
- 2
- Rep Power
- 0
Could not find the main class: mocha.Decompiler.
Hello everyone,
I have a problem with mocha:
1. I have installed jdk 6u22 and jre 6u22;
2. I have copyed the myclass.class and mocha.zip to the same folder - c:\myclasses;
But when I typed "java mocha.Decompiler -v -o myclass.class" in the CMD window with "c:\myclasses>" prompt then pressed "Enter", I got the massage as follow:
---------------------------------------------------------------------
Exception in thread "main" java.lang.NoClassDefFoundError: mocha/Decompiler
Caused by: java.lang.ClassNotFoundException: mocha.Decompiler
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: mocha.Decompiler. Program will exit.
------------------------------------------------------------------------
What's the reason.Could somebody help me ?
Thanks a lot.Last edited by Aman; 12-01-2010 at 03:25 AM. Reason: errors
- 12-01-2010, 06:40 AM #2
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,547
- Rep Power
- 11
thread "main" java.lang.NoClassDefFoundError: mocha/Decompiler
This means that the java executable could not find mocha.Decompiler on the classpath.
Things to do/check:
(1) Make sure you have the mocha classes or jar file in c:\myclasses and not the .zip file. You might have to extract the zip file to get at the classes.
(2) Specify the classpath on the command line. If the zip contains a jar file like mocha.jar then the command will look something like
Java Code:java -cp mocha.jar mocha.Decompiler -v -o myclass.class
If the zip has a mocha folder within it then the command will look like
Java Code:java -cp . mocha.Decompiler -v -o myclass.class
Read the instructions that came with the library, or are available from whereever you got it. You need usage instructions.
(3) Make sure mocha.Decompiler has a main() method. Or, to put it another way, read the instructions and confirm that this is the class you should be specifying on the command line.
- 12-01-2010, 02:56 PM #3
Member
- Join Date
- Dec 2010
- Posts
- 2
- Rep Power
- 0
Thank you, pbrockway.
With your advices,I checked my steps carefuly, then found the reason.
I made a low level mistake, I forgot to specify the classpath.
(Don't laugh , I am a brand-new beginner.....hehe....)
So, When I specify the classpath like this
It works.SET CLASSPATH=c:\myclasses;c:\myclasses\mocha.zip
The result is
Thanks again, rockway!C:\myclasses>java mocha.Decompiler
Usage: java mocha.Decompiler [-v] [-o] <Class1.class> <Class2.class>...
Best wishes for you!Last edited by Aman; 12-01-2010 at 03:02 PM. Reason: Errors
- 12-01-2010, 08:55 PM #4
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,547
- Rep Power
- 11
Similar Threads
-
Could Not Find Main Class (again)
By illjavathat in forum New To JavaReplies: 25Last Post: 11-23-2010, 09:49 AM -
Could Not Find Main Class (AGAIN!)
By illjavathat in forum New To JavaReplies: 54Last Post: 10-22-2010, 03:22 AM -
could not find main class?
By deathnote202 in forum New To JavaReplies: 6Last Post: 05-10-2010, 08:57 PM -
Could not find main class - JDK 1.6
By Syranno in forum New To JavaReplies: 1Last Post: 07-25-2008, 04:07 PM -
JVM Could not find main class
By banduskank in forum Advanced JavaReplies: 2Last Post: 06-24-2008, 08:05 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks