Teen Programmers Unite  
 

 

Return to forum top

Exception

Posted by taubz [send private reply] at July 25, 2002, 09:16:35 PM

Whoops, sorry, I guess I glossed over the rest of your post when I detected incorrect information. :)

Posted by gian [send private reply] at July 25, 2002, 09:06:48 PM

Okay. That helped heaps. Thanks guys.

Posted by mrnorman [send private reply] at July 25, 2002, 01:09:29 PM

dude, I said "or forgetting to take off the '.class' part when using the java command in a shell." It just wasn't quite as 'technically' correct, lol.

Posted by taubz [send private reply] at July 24, 2002, 07:03:18 PM

Actually, no. The exception means the class "test2/class" could not be found. The runtime got the name "test2/class" by taking the *class* name you specified on the command line "test.class" and replacing the dot with the slash (like java.lang.System is in the java/lang/ directory).

The runtime wants the class name "test2," not the file name "test2.class." I make that mistake all the time. :)

(A missing main() function would be another exception.)

- taubz

Posted by mrnorman [send private reply] at July 24, 2002, 06:08:12 PM

That means that when the runtime engine ran your class, it couldn't find the main(String[] args) function. Often times, this comes from misspelling, or forgetting to take off the '.class' part when using the java command in a shell. Also, you may have forgotten to make the function public static void. Hopefully this helped some...

Posted by gian [send private reply] at July 24, 2002, 05:11:33 PM

I keep getting the following when trying to execute class files that have successfully compiled:
"Exception in thread "main" java.lang.NoClassDefFoundError: test2/class".

It doesn't seem to matter what code it is I'm executing (mine or not). Could this be a sign of a bungled install?

You must be logged in to post messages and see which you have already read.

Log on
Username:
Password:
Save for later automatic logon

Register as a new user
 
Copyright TPU 2002. See the Credits and About TPU for more information.