File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Console Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Console" Watch "Console" New topic
Author

Console

gunjan khanuja
Ranch Hand

Joined: Apr 16, 2012
Posts: 37


can anybody please explain what to do when this program is run through Command prompt.I get this output after i compile and run this program in cmd.
java propogate???Please explain?


Exception in thread "main" java.lang.NoClassDefFoundError: Propogate/class
Caused by: java.lang.ClassNotFoundException: Propogate.class
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: Propogate.class. Program will exit.
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

gunjan khanuja wrote:
java propogate???

1. java is case sensitive
2. that class file has package
John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
How do you run your java command?

java Propogate.class

or

java Propogate
gunjan khanuja
Ranch Hand

Joined: Apr 16, 2012
Posts: 37
i ran the code using both the statements and i got this error..Please clarify


D:\Mobility\eclipse\workspace_abhijeet\Propagate\src\com\tcs>java Propogate
Exception in thread "main" java.lang.NoClassDefFoundError: Propogate (wrong name



: com/tcs/Propogate)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
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: Propogate. Program will exit.

D:\Mobility\eclipse\workspace_abhijeet\Propagate\src\com\tcs>java Propogate.clas
s
Exception in thread "main" java.lang.NoClassDefFoundError: Propogate/class
Caused by: java.lang.ClassNotFoundException: Propogate.class
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: Propogate.class. Program will exit.

D:\Mobility\eclipse\workspace_abhijeet\Propagate\src\com\tcs>


John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
You should have your package structure in the java cmd.

So it should be java com.tcs.Propogate

Also note that there should be a package structure com/tcs/Propogate.class in the classpath.
saloni jhanwar
Ranch Hand

Joined: Feb 09, 2012
Posts: 583

Do one thing delete previous compiled "Propogate.class" and "Propogate.java.bak" file and then recompile it.Some times i also get same problem.


Tell the difficulties that i am difficult.
John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
gunjan khanuja wrote:
Exception in thread "main" java.lang.NoClassDefFoundError: Propogate (wrong name

This error typically comes when you have the class name without the valid package structure.
 
 
subject: Console