• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Console

 
gunjan khanuja
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
gunjan khanuja wrote:
java propogate???

1. java is case sensitive
2. that class file has package
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you run your java command?

java Propogate.class

or

java Propogate
 
gunjan khanuja
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 583
Firefox Browser Notepad Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do one thing delete previous compiled "Propogate.class" and "Propogate.java.bak" file and then recompile it.Some times i also get same problem.
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic