# Java Exception - NoDefClassFoundError

1. May 10, 2012

### rollcast

I'm trying to run a java program I coded using geany but it would let me run it as it comes up with the following error message.

Code (Text):
Exception in thread "main" java.lang.NoClassDefFoundError: temp
Caused by: java.lang.ClassNotFoundException: temp
at java.net.URLClassLoader$1.run(URLClassLoader.java:217) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:321) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
Could not find the main class: temp. Program will exit.
So then I thought it may have been my bad coding but even when I copied a few example codes from wikipedia it still gave me the same error?

Thanks
A.

2. May 10, 2012

### Staff: Mentor

It looks like you are missing a definition for a class named temp.

3. May 10, 2012

### AlephZero

Java is different from most programming languages in that it is VERY fussy about what you call your program files, and the directory structure you put them in.

There should be a "hello world" type of example in the system documentation. Try that, and make sure you do EXACTLY what it tells you to do.

You might have to set up some environment variables (CLASSPATH, in particular) before anything works.