954,536 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

A critical problem in run time of code

Hi!!!!!!

I am facing a problem at the run time of the java byte code.

I am using JDK 1.5 in OS Win XP on and i have installed it properly...

its compile time is working exactly i.e. javac command produces byte code

but when i use command java class-name (the class containing main method)

i got an exception

Exception in thread "main" java.lang.NoClassDefFoundError: MainClass

As i hope there is no problem of class path because java & javac are working.

There is no problem in setup of jdk 1.5 because it is working well in my OS WIN Millenium properly..

I also try by re installing JDK but i got no solution.:confused:

Please REPLY that how this problem can be solved AND WHAT SHOULD I DO ????...... :?:

gauravagg2
Newbie Poster
7 posts since Aug 2009
Reputation Points: 8
Solved Threads: 0
 

Post code and the name of the file.
Also you probably need to set the classpath.

javaAddict
Nearly a Senior Poster
Team Colleague
3,329 posts since Dec 2007
Reputation Points: 1,014
Solved Threads: 448
 

The class containing main method should be public

public class abc {
.....
}


and the filename should be same as class name...

harsh2327
Junior Poster in Training
56 posts since May 2008
Reputation Points: 27
Solved Threads: 8
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You