• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

I can compile my java code but cant run it

 
Ankit Tripper
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am able to compile my java code but cant run it throught cmd window , it says : NoClassDefFoundError .
But when i try eclipse , everything is working fine .
Whats wrong here ?
 
Tim Moores
Bartender
Posts: 2675
33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Most likely the classpath. How are you trying to run the code? Post what you're entering on the command line.
 
Srinivas Reddy Mudimala
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
provide the java file code that you are trying to run fromcnd
 
Mohamed Sanaulla
Saloon Keeper
Posts: 3159
33
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HowToSetTheClasspath
 
Ankit Tripper
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Moores wrote:Most likely the classpath. How are you trying to run the code? Post what you're entering on the command line.


I have been using jdk on my system for months , this is a new problem , so i dont think its classpath .
cmd>javac A.java
cmd>java A
NoClassDefFoundError
 
Ankit Tripper
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Srinivas Reddy Mudimala wrote:provide the java file code that you are trying to run fromcnd


this problem is not with any particular file , its a general problem .
And please remember , it is working fine with Eclipse .
 
Paul Clapham
Sheriff
Pie
Posts: 20725
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So you have a problem with the classpath when you try to run classes from the classpath. Eclipse would be irrelevant to that problem because it has an entirely different way of setting the classpath (which it calls "build path").


 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will need to provide the source for class A because a simple "hello world" app works with the steps you posted. In particular, does A extend anything, or does A require other classes? The source would answer these questions.

And by the way, please pay attention to the private message sent to you. Fixing your display name is not an option!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic