aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes I can compile my java code but cant run it Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "I can compile my java code but cant run it" Watch "I can compile my java code but cant run it" New topic
Author

I can compile my java code but cant run it

Ankit Tripper
Greenhorn

Joined: Aug 13, 2011
Posts: 5
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
Rancher

Joined: Sep 21, 2011
Posts: 2408
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

Joined: Nov 17, 2011
Posts: 2
provide the java file code that you are trying to run fromcnd
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3071
    
  33

HowToSetTheClasspath


Mohamed Sanaulla | My Blog
Ankit Tripper
Greenhorn

Joined: Aug 13, 2011
Posts: 5
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

Joined: Aug 13, 2011
Posts: 5
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
Bartender

Joined: Oct 14, 2005
Posts: 18675
    
    8

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

Joined: May 14, 2008
Posts: 5837
    
    7

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!


JBoss In Action
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I can compile my java code but cant run it