Jump to content
  • Advertisement
Sign in to follow this  
Lucky Ace Card

Please help me with installing Java

This topic is 4380 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Man, I feel like an idiot. I must have installed Java incorrectly. I'm just starting to learn it, so I wrote the HelloWorld.java program. I went into command prompt, did javac HelloWorld.java And it created the class file. However, if I do: java HelloWorld in command prompt, I get this error: Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld Any help on what I did wrong? Thanks a bunch... I'm learning from some outdated book.

Share this post


Link to post
Share on other sites
Advertisement
Is the class name EXACTLY the same as the output class name, including the caps of the characters?

Dave

Share this post


Link to post
Share on other sites
On a side note: that slightly annoying message can pop up in another situation -- say you have created a moderately large project -- and you use packages. If you navigate to your source folder and compile your code...then try to run the app, it will often fall over with the same message. Reason for this is because packages created by applications (...eclipse, etc) will resolve to a directory structure...so, if you move up a level (cd ..) and try java presentWorkingDirectory/mainclass (or presentWorkingDirectory.mainclass) it will work without a fuss...still, it's a minor issue though it bugged me when it came up :)

Hence why I now create a batch file to run my java programs ;)


~Shiny.

Share this post


Link to post
Share on other sites
Everyone here is so helpful. Thanks Shiny, I'll remember that for future use. And thanks squashed_bug, I totally forgot about the "." entry. That helps.
Thanks guys.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!