Java Exception - NoDefClassFoundError

  • Context: Java 
  • Thread starter Thread starter rollcast
  • Start date Start date
  • Tags Tags
    Java
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
2 replies · 5K views
rollcast
Messages
403
Reaction score
0
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:
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)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
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.
 
Physics news on Phys.org
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.