Results 1 to 3 of 3
Like Tree1Likes
  • 1 Post By Junky

Thread: Error when run from Command Prompt

  1. #1
    hqt is offline Member
    Join Date
    Nov 2011
    Rep Power

    Question Error when run from Command Prompt

    I have a simple "HelloWorld" program. (filename:
    Java Code:
    class HelloWorld{
    public static void main(String[] args){
    System.out.println("Hello World");
    this program I run smoothly in NetBean IDE, but when I compiled it in command prompt, I have a problem:
    Java Code:
    javac  //Sucessful
    java HelloWorld.class //Error
    Error that I have received is:
    Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld/class
    Caused by:
    java.lang.ClassNotFoundException: HelloWorld.class
    at java.nt.URLClassLoader$ Source)
    at java.securitiy.AccessController.doPriviledged (Native Method)
    at Source)
    at java.lang.ClassLoader.LoadClass(Unknown Source)
    and some many line ... but still long that I cannot type :">

    So, It's really frustrate with me :( Who know this problem, please help me :(
    thanks :)

  2. #2
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Rep Power

    Default Re: Error when run from Command Prompt

    java FileName
    hqt likes this.

  3. #3
    ADustedEwok is offline Member
    Join Date
    Dec 2011
    Rep Power

    Default Re: Error when run from Command Prompt

    1. You didnt path you program correctly to command prompt...

    2. You need to find the proper folder.
    cd documents
    then just do javac [whatever program is called].java
    finally java [whatever program is called]

    then should work... I just use bluej because it runs the program completely seperately in a console.

Similar Threads

  1. Letting my program command the command prompt
    By Smokey. in forum Threads and Synchronization
    Replies: 4
    Last Post: 03-29-2011, 11:34 PM
  2. New Command prompt
    By jmga9 in forum New To Java
    Replies: 4
    Last Post: 11-10-2010, 01:53 AM
  3. Error compiling java subclass from command prompt
    By littleone in forum New To Java
    Replies: 5
    Last Post: 10-26-2010, 03:45 PM
  4. error in the Command Prompt when running a bat file
    By bluesagemedia in forum New To Java
    Replies: 1
    Last Post: 10-03-2010, 01:05 AM
  5. How to return command prompt error message
    By raxwer in forum Advanced Java
    Replies: 3
    Last Post: 05-26-2010, 05:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts