Hi all I am trying ot use Netbeans 6.9.1 to write a basic "hello world" java script,
but it keeps giving me the following error;
**********************************************************************
debug:
Have no file for C:\Program Files\Java\jdk1.6.0_23\jre\lib\modules\jdk.boot.jar
java.lang.NoClassDefFoundError: helloworld/Main
Caused by: java.lang.ClassNotFoundException: helloworld.Main
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: helloworld.Main. Program will exit.
Exception in thread "main" Java Result: 1
BUILD SUCCESSFUL (total time: 2 seconds)
****************************************************************************

I have attached the Java File for your review.
Any assistance in figuring out why I am getting this message will be greatly apprecaited.
I know its just something simple.

THanks
COY

The name of your class should be the same as the name of your Java file i.e. Main.

The name of your class should be the same as the name of your Java file i.e. Main.

Hmm OK I thought it was?
Can you show me where I need to change it?

thanks

In your source code i.e. Main.java file change class HelloWorld to class Main .

In your source code i.e. Main.java file change class HelloWorld to class Main .

That worked!!

Thanks alot.

I am getting ready to start a class in college on Java, and I wanted to get a leg up so I went to this site hxxp://www.freejavaguide.com/corejava1.htm to try and learn something about how it works, but it isn't all that informative I guess ;)


COY

If you've just started out with Java, give the forum sticky (by yours truly ;-)) a read. It's a decent intro (jam packed with information).

If you are looking to get started in a quick and dirty way, nothing beats the official tutorials (click on the Getting started link).

BTW, if your question/query was resolved, please click on the "Mark this thread as solved" button at the bottom of this thread. Good luck.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.