CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Threaded View

  1. #5
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    Re: GUI example won't work

    Quote Originally Posted by coder752 View Post
    Error message reads like this:

    Exception in thread "main" java.lang.NoClassDefFoundError: TextDemo (wrong name:
    components/TextDemo)
    ...
    Could not find the main class: TextDemo. Program will exit.
    OK, you didn't answer my question about how you ran it, which isn't very helpful, but I'll take a guess anyway...

    The TextDemo class is in package directory 'components', so its fully qualified name is 'components.TextDemo', but I'm guessing you told it to run just 'TextDemo' instead, from inside the 'components' directory. The runtime read the TextDemo class, saw the 'components' package declaration and realised the name was wrong. When you run classes, you should run them from the directory that contains the root package directory, and specify the fully qualified name (i.e. include the package or packages in the name).

    This is very basic stuff - I recommend you learn about packages and how to run a Java program with java.exe.

    Unless in communicating with it [a computer] one says exactly what one means, trouble is bound to result...
    A. Turing
    Last edited by dlorde; August 1st, 2009 at 01:49 PM.
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

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
  •  





Click Here to Expand Forum to Full Width

Featured