| Author |
Exception in thread "main"
|
rick collette
Ranch Hand
Joined: Mar 22, 2002
Posts: 208
|
|
Hi, I have the following class, it compiles, but gives me the following error: Exception in thread "main" java.lang.NoClassDefFoundError: --------- public class ServiceClient{ public static void main(String args[]){ System.out.println("Hi!"); } } I am wondering if something is wrong with my classpath: CLASSPATH: C:\jdk1.3.1\bin;C:\j2sdkee1.3.1\bin JAVA_HOME: C:\jdk1.3.1 I recently installed win2k, it never happened on my win98. I got the same problem on Eclipse with different "program will exit" error. Thanks, Rick
|
 |
Philip Shanks
Ranch Hand
Joined: Oct 15, 2002
Posts: 189
|
|
I didn't see '.' in the class path. It appears that the runtime class loader is finding everything except the class that you wrote! If you are going to specify a class path, then you need to have the current directory as part of it. Execution from the command line (assuming you are in the same directory as MyClass.class) would look something like this: java -cp .;path\to\jsee.jar;path\to\another.jar MyClass optional cmd line args
|
Philip Shanks, SCJP - Castro Valley, CA
My boss never outsources or has lay-offs, and He's always hiring. I work for Jesus! Prepare your resume!
|
 |
rick collette
Ranch Hand
Joined: Mar 22, 2002
Posts: 208
|
|
Thank you, Philip: Yes, you are right. I actually put '.' on my classthpath. And even I rebuid the program, it still throws me the same error. Rather strange. thanks,
Originally posted by Philip Shanks: I didn't see '.' in the class path. It appears that the runtime class loader is finding everything except the class that you wrote! If you are going to specify a class path, then you need to have the current directory as part of it. Execution from the command line (assuming you are in the same directory as MyClass.class) would look something like this: java -cp .;path\to\jsee.jar;path\to\another.jar MyClass optional cmd line args
|
 |
 |
|
|
subject: Exception in thread "main"
|
|
|