can't run any file on dos....please help me!!


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 6 of 6

Thread: can't run any file on dos....please help me!!

  1. #1
    tg Guest

    can't run any file on dos....please help me!!


    I've got a basic and serious problem.
    I can't have any file, even a simple file like 'Hello World', run on dos.
    I've set the proper path of jdk directory, and it compiles my file without
    any error, making a 'class' file. However, everytime I try to run it, it
    shows a messege :

    Exception in thread "main" java.lang.NoClassDefFoundError: (file name)

    When I run the same file with KAWA, a popular editor, it works with no error.

    Now, I need your help to solve this problem. I'll be waiting for your answer...


  2. #2
    Ako Guest

    Re: can't run any file on dos....please help me!!


    Check the bin directory to see if you have java.exe and check your path again
    these are the only causes for your problem.

    Good luck

    Ako




    "tg" <oyfly75@hotmail.com> wrote:
    >
    >I've got a basic and serious problem.
    >I can't have any file, even a simple file like 'Hello World', run on dos.
    >I've set the proper path of jdk directory, and it compiles my file without
    >any error, making a 'class' file. However, everytime I try to run it, it
    >shows a messege :
    >
    >Exception in thread "main" java.lang.NoClassDefFoundError: (file name)
    >
    >When I run the same file with KAWA, a popular editor, it works with no error.
    >
    >Now, I need your help to solve this problem. I'll be waiting for your answer...
    >



  3. #3
    Paul Clapham Guest

    Re: can't run any file on dos....please help me!!

    You've edited the error message so that it's hard to tell what the problem
    is. However, to run a class you type this: "java theClass" and not this:
    "java theClass.class". That's one common error made by beginners.

    PC2

    "tg" <oyfly75@hotmail.com> wrote in message news:3b034ac5$1@news.devx.com...
    >
    > I've got a basic and serious problem.
    > I can't have any file, even a simple file like 'Hello World', run on dos.
    > I've set the proper path of jdk directory, and it compiles my file without
    > any error, making a 'class' file. However, everytime I try to run it, it
    > shows a messege :
    >
    > Exception in thread "main" java.lang.NoClassDefFoundError: (file name)
    >
    > When I run the same file with KAWA, a popular editor, it works with no

    error.
    >
    > Now, I need your help to solve this problem. I'll be waiting for your

    answer...
    >




  4. #4
    ammon Guest

    Re: can't run any file on dos....please help me!!


    "tg" <oyfly75@hotmail.com> wrote:
    >
    >I've got a basic and serious problem.
    >I can't have any file, even a simple file like 'Hello World', run on dos.
    >I've set the proper path of jdk directory, and it compiles my file without
    >any error, making a 'class' file. However, everytime I try to run it, it
    >shows a messege :
    >
    >Exception in thread "main" java.lang.NoClassDefFoundError: (file name)
    >
    >When I run the same file with KAWA, a popular editor, it works with no error.
    >
    >Now, I need your help to solve this problem. I'll be waiting for your answer...
    >

    Do you have set your classpath?


  5. #5
    Rich Guest

    Re: can't run any file on dos....please help me!!


    "tg" <oyfly75@hotmail.com> wrote:
    >
    >I've got a basic and serious problem.
    >I can't have any file, even a simple file like 'Hello World', run on dos.
    >I've set the proper path of jdk directory, and it compiles my file without
    >any error, making a 'class' file. However, everytime I try to run it, it
    >shows a messege :
    >
    >Exception in thread "main" java.lang.NoClassDefFoundError: (file name)
    >
    >When I run the same file with KAWA, a popular editor, it works with no error.
    >
    >Now, I need your help to solve this problem. I'll be waiting for your answer...
    >



    You said you have set the Path environment variable to point to the correct
    directory. Have you set the classpath environment variable? If you haven't
    set it to "." (without quotes). This means the JVM will run your programs
    from the directory where they are stored. So once the variable is set you
    should be able to go to the directory where your program is stored and type
    "java HelloWorld" and hopefully it will work.

    Let me know how you get on.

    Rich

  6. #6
    Andrew Greiner Guest

    Re: can't run any file on dos....please help me!!


    "Rich" <richard.bowen@power.alstom.com> wrote:
    >
    >"tg" <oyfly75@hotmail.com> wrote:
    >>
    >>I've got a basic and serious problem.
    >>I can't have any file, even a simple file like 'Hello World', run on dos.
    >>I've set the proper path of jdk directory, and it compiles my file without
    >>any error, making a 'class' file. However, everytime I try to run it, it
    >>shows a messege :
    >>
    >>Exception in thread "main" java.lang.NoClassDefFoundError: (file name)
    >>
    >>When I run the same file with KAWA, a popular editor, it works with no

    error.
    >>
    >>Now, I need your help to solve this problem. I'll be waiting for your answer...
    >>

    >java -cp "." HelloWorld

    Basically it says java -classpath "." <-- current directory then Application
    Name.
    >
    >You said you have set the Path environment variable to point to the correct
    >directory. Have you set the classpath environment variable? If you haven't
    >set it to "." (without quotes). This means the JVM will run your programs
    >from the directory where they are stored. So once the variable is set you
    >should be able to go to the directory where your program is stored and type
    >"java HelloWorld" and hopefully it will work.
    >
    >Let me know how you get on.
    >
    >Rich



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center