Problem with running java program

Hey again!

I missed out some information in last posting.. here is the full description

I have just installed 1.5.0_06 and have set paths and what otherwise is necessary to run the java programs. I was testing the install and run a standard HelloWorld.java program

I got the following error:

Exception in thread main java.lang.NoClassDefFoundError: HelloWorld

what is wrong...

Here is the entire HelloWorld.java

public class HelloWorld

{

public HelloWorld()

{

System.out.println("Hello World");

}

public static void main(String[] args)

{

HelloWorld hw = new HelloWorld();

}

}

I have checked that the path is correct too..

Hopefully someone can help me!

Anders

[793 byte] By [Psyco_Boysa] at [2007-10-2 10:05:43]
# 1

Your Path is set, probably the problem is classpath.

Change the cmd/command prompt to the directory that contains your HelloWorld.class file, verifying that it exists. If it does, issue this command from that directory:

java -cp . HelloWorld

Important: include the period and surrounding spaces

If that works, you can learn about setting and using the classpath here:

http://java.sun.com/j2se/1.5.0/docs/tooldocs/index.html#general

By the way, just add a reply to your original post with the additional information, rather than creating another post. That eliminates duplication of replies.

ChuckBinga at 2007-7-13 1:21:26 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 2
Thanks!That worked!Anders
Psyco_Boysa at 2007-7-13 1:21:26 > top of Java-index,Java HotSpot Virtual Machine,Specifications...