Results 1 to 8 of 8

Thread: Run Time error

  1. #1
    newNoob is offline Member
    Join Date
    May 2016
    Posts
    4
    Rep Power
    0

    Default Run Time error

    Hi,

    It's my very first Hello world java program. I am able to compile the java code to create a class file. Both .java and .Class file are in the same location.However, when I am trying to run the code I am getting following error -

    java/lang/NoClassDefFoundError: java/lang/object

    I have Java SE8 in my system and I am using window command prompt to compile and run the code.

    Thanks in advance

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,422
    Blog Entries
    7
    Rep Power
    28

    Default Re: Run Time error

    Can you show the code you tried to compile?

    kind regards,

    Jos
    Build a wall around Donald Trump; I'll pay for it.

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,003
    Rep Power
    33

    Default Re: Run Time error

    java/lang/NoClassDefFoundError: java/lang/object
    Did you copy and paste that message or did you type it in?
    Java's Object class's first letter is uppercase
    If you don't understand my response, don't ignore it, ask a question.

  4. #4
    newNoob is offline Member
    Join Date
    May 2016
    Posts
    4
    Rep Power
    0

    Default Re: Run Time error

    Here is the code I compiled:

    class HelloWorldApp {
    public static void main(String[] args) {
    System.out.println("Hello World!"); // Display the string.
    }
    }

  5. #5
    newNoob is offline Member
    Join Date
    May 2016
    Posts
    4
    Rep Power
    0

    Default Re: Run Time error

    I typed it in. Indeed, it's 'Object' in the error message, not 'object'.

  6. #6
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    14

    Default Re: Run Time error

    The containing file should be HelloWorldApp.java
    to compile: javac HelloWorldApp.java
    to run: java HelloWorldApp

    This presumes you are in the same directory.

    I recommend checking the tutorials in my signature on how to compile and run programs.

    BTW, your program compiled and ran just fine.

    Regards,
    Jim
    Last edited by jim829; 05-22-2016 at 08:53 PM.
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  7. #7
    newNoob is offline Member
    Join Date
    May 2016
    Posts
    4
    Rep Power
    0

    Default Re: Run Time error

    Thanks, Jim.
    I am using the same commands, still getting run time error. Both java and Class files are in the same directory. Not sure what is missing. Here is the command prompt screenshot-

    Run Time error-run-time-error.jpg

  8. #8
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    14

    Default Re: Run Time error

    The only thing I can think of is that you may have multiple versions of Java installed and its getting confused.
    It might also be a 32 vs 64 bit issue too. But I am just guessing at this point.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

Similar Threads

  1. Replies: 0
    Last Post: 10-04-2013, 05:27 AM
  2. Replies: 3
    Last Post: 03-25-2012, 04:57 AM
  3. the compile time error is below
    By nicholil in forum New To Java
    Replies: 2
    Last Post: 11-07-2010, 01:52 AM
  4. Error while logging in first time in struts 2
    By sameerk in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 11-03-2010, 08:53 AM
  5. Help. Java run time error
    By slimce in forum New To Java
    Replies: 7
    Last Post: 05-15-2010, 04:15 PM

Tags for this Thread

Posting Permissions

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