Hi, I installed j2sdk1.4.1_05 in my computer. I saved it under C:\j2sdk1.4.1_05. I am writing some programs that is under c:\myfiles\program\java. I am using text pad to write my programs. MY program is compiling but when I try to run it , it is showing Exceptin in thread 'main' java.lang.NoClassDefFoundError I set my environ variables like this this is user classpath: C:\j2sdk1.4.1_05\lib path: C:\j2sdk1.4.1_05\bin and this is for the system classpath: C:\j2sdk1.4.1_05\lib path:%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\j2sdk1.4.1_05\bin
I am not getting what is the problem. Could anyone help me
Hi, Welcome to JavaRanch! If the error message is as you say, then you've installed Java correctly and everything is working. But the class you're trying to run must have a method named "main" with a specific signature: public static void main(String args) If it's different, your program won't run and you'll see this error message.
If in case you have already defined main(), then consider adding current directory (".") to the classpath. For eg: your classpath will look like, CLASSPATH=.;C;\jdk....... If you send out the code you wrote it will help. [ October 22, 2003: Message edited by: Vinod Venkatasubramanian ]
author and iconoclast
Indeed, I must've been sleepy, because I didn't notice his CLASSPATH. Please, beginning Java programmers: don't set the CLASSPATH environment variable at all. Java knows how to find its own class files by default. The default class path -- i.e., with no value for this environment variable -- will work perfectly, certainly long enough for you learn the Java language. By the time you know enough Java to consider changing it, any error messages you get in the process will make sense to you.