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;
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.


Edited by Coyboss: added entire folder with project in it

package helloworld;

/** Comment
 * Displays "Hello World!" to the standard output.

class HelloWorld {

  public static void main (String args[]) {

    System.out.println("Hello World!");   //Displays the enclosed String on the Screen Console


7 Years
Discussion Span
Last Post by ~s.o.s~

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?



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

Edited by ~s.o.s~: n/a


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 ;)



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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.