Java Java Exception - NoDefClassFoundError

  • Thread starter Thread starter rollcast
  • Start date Start date
  • Tags Tags
    Java
AI Thread Summary
The discussion centers on a user encountering a "NoClassDefFoundError" when trying to run a Java program in Geany. The error indicates that the Java runtime cannot find the main class named "temp." It emphasizes that Java requires precise naming conventions for program files and adherence to directory structures. The user is advised to test a simple "hello world" example from the system documentation to ensure proper setup. Additionally, setting up environment variables, particularly the CLASSPATH, may be necessary for the program to run successfully.
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.
 
Technology news on Phys.org
It looks like you are missing a definition for a class named temp.
 
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.
 
Thread 'Star maps using Blender'
Blender just recently dropped a new version, 4.5(with 5.0 on the horizon), and within it was a new feature for which I immediately thought of a use for. The new feature was a .csv importer for Geometry nodes. Geometry nodes are a method of modelling that uses a node tree to create 3D models which offers more flexibility than straight modeling does. The .csv importer node allows you to bring in a .csv file and use the data in it to control aspects of your model. So for example, if you...
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
Back
Top