i have PROBLEM


Dears!
i am new in java programming.....i want some help from you....but at this time i can`t run the simple java program ..which is following

class example {
public static void main (String args[])
{
int a;
for(a=0;a<=10;a++)
{
System.out.println(""+a);}
}}

when i run the program by using command promt such as

D:>cd jdk1.4in

D:jdk1.4in>javac example.java

D:jdk1.4in>java example
Exception in thread "main" java.lang.NoClassDefFoundError: example

D:jdk1.4in>

you can see that program compile success fully .....but it can`t run.
.........why? and what is the meaning of this
" Exception in thread "main" java.lang.NoClassDefFoundError: "


....................i hope that u solve my problem

many regards



Comments

  • :
    : Dears!
    : i am new in java programming.....i want some help from you....but at this time i can`t run the simple java program ..which is following
    :
    : class example {
    : public static void main (String args[])
    : {
    : int a;
    : for(a=0;a<=10;a++)
    : {
    : System.out.println(""+a);}
    : }}
    :
    : when i run the program by using command promt such as
    :
    : D:>cd jdk1.4in
    :
    : D:jdk1.4in>javac example.java
    :
    : D:jdk1.4in>java example
    : Exception in thread "main" java.lang.NoClassDefFoundError: example
    :
    : D:jdk1.4in>
    :
    : you can see that program compile success fully .....but it can`t run.
    : .........why? and what is the meaning of this
    : " Exception in thread "main" java.lang.NoClassDefFoundError: "
    :
    :
    : ....................i hope that u solve my problem
    :
    : many regards
    :
    :
    :
    :
    The JVM tries to find the file example without any extension. Since a compiled java class has the extension .class, you need to add the extension.

  • sir,
    i have already save the programe with example.java & example.class extension...
  • :
    : sir,
    : i have already save the programe with example.java & example.class extension...
    :
    When you run the program include the extension. Thus:
    [code]
    java example.class
    [/code]
    also make sure you call it from the folder where the class file resides.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories