I've just installed Sun's Java JDK 1.5_08 and I've set PATH C
ath to java\bin under Environment Variables.
Compiling a java program I've written works fine as the .class file appears. But when it comes to running it via e.g. "java hello" after I've compiled via "javac hello.java" it doesn't seem to run and instead, I get this error:
C:\ComSci\DCS100>javac hello.java
C:\ComSci\DCS100>java hello
Exception in thread "main" java.lang.NoClassDefFoundError: hello
Code:
/* ***************************************
AUTHOR: Paul Curzon
A program that prints a welcome message
Notice how the program called hello is
made of 2 methods. One called main
and one called helloMessage.
****************************************/
class hello
{
public static void main (String[] param)
{
// We want to print out the message defined in method helloMessage
helloMessage();
System.exit(0);
} // END main
/* ***************************************************
Define some commands of our own to use above
*************************************************** */
/* ***************************************
*
* Define a method to print a welcome message
*/
public static void helloMessage ()
{
System.out.println("Hello Mark");
} // END helloMessage
} // END class hello