[hotjoe.com] HotJoe Java Help Forums
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Visit java.com
Please send email if you are having login problems - see the posts below for more info.
Hotmail and Yahoo! users - please see the Hotmail post or the Yahoo! post for information on lost emails.
Exception in thread "main" java.lang.NoClassDefFoundError - Urgent help required  XML
Forum Index » New to Java
Author Message
lmr

Newbie

Joined: 06/02/2006 06:09:35
Messages: 3
Offline

Have just downloaded JDK 1.5.0_07 on PC with WindowsXP. Program compiles ok but I get the following runtime error:Exception in thread "main" java.lang.No ClassDefFoundError: I think I've tried just about everything under the sun and am running out of time to finish my assignment

This message was edited 1 time. Last update was at 06/02/2006 06:24:15

tfecw

Newbie

Joined: 09/19/2005 15:02:20
Messages: 144
Location: No. VA.
Offline

lmr wrote:Have just downloaded JDK 1.5.0_07 on PC with WindowsXP. Program compiles ok but I get the following runtime error:Exception in thread "main" java.lang.No ClassDefFoundError: I think I've tried just about everything under the sun and am running out of time to finish my assignment


Give this command a shot:


java -cp . (nameOfYourClass)


And let us know how it goes.
aim icon
lmr

Newbie

Joined: 06/02/2006 06:09:35
Messages: 3
Offline

Gives me - unrecognised option -cp.<classname>. Could not create the Java virtual machine. It seems I'm missing something but I don't know what. I have the java and class files saved on my flash drive (E and Java is loaded on (C. When I view the java files on my flash drive they just look like text files not java files but they are all .java
stdunbar

Newbie
[Avatar]

Joined: 06/22/2005 14:51:37
Messages: 849
Location: Superior, CO, USA
Offline

Can you give us a bit more information about your directory structure? Java is very picky that if a class is in a package that it must have the same directory structure as the packing. So if your class is in the package a.b then your class has to be in the directory a/b/YourClassName.class.

Thanks for using the forums at hotjoe.com
[WWW] [Yahoo!] [ICQ]
lmr

Newbie

Joined: 06/02/2006 06:09:35
Messages: 3
Offline

Have relocated all files to C: drive To give a specific example my assignment "studentEntry" is located as in C:\classwork\studentEntry.class and the java file is C:\classwork\studentEntry.java
The java program is located in C:\program files\java

This message was edited 1 time. Last update was at 06/02/2006 19:56:24

nvidura

Newbie

Joined: 06/07/2006 06:45:53
Messages: 1
Offline

lmr wrote:Have just downloaded JDK 1.5.0_07 on PC with WindowsXP. Program compiles ok but I get the following runtime error:Exception in thread "main" java.lang.No ClassDefFoundError: I think I've tried just about everything under the sun and am running out of time to finish my assignment


first of all check by typing on cmd prompt (javac) that if it shows u some deffinitions than ur class path is ok. when u execute your class file the only ned to give is your class file name on cmd prompt. like

c:\>java temp (enter)

if found this error in future then u defined the class as public in which u defined ur main func.
so
name ur file same as ur public class file (case is also considered) ur prob is solved. now only thing hv to do is just type temp


This answer must help you.

This message was edited 1 time. Last update was at 06/07/2006 06:58:54


Sri Lankan Friends
[WWW]
eranga262154

Newbie

Joined: 07/24/2006 00:46:25
Messages: 14
Location: Sri Lanka
Offline

stdunbar wrote:Can you give us a bit more information about your directory structure? Java is very picky that if a class is in a package that it must have the same directory structure as the packing. So if your class is in the package a.b then your class has to be in the directory a/b/YourClassName.class.



You mean that this is problem with classpath. When i'm working with Java I set the classpath as follows to the working directory.

D:\java> path=C:\jdk1.4.0\bin\

C: is the java instalation driver and D: is the working directory.

What you think about that.

Is it the case with
Re:Exception in thread "main" java.lang.NoClassDefFoundError - Urgent help required
 
Forum Index » New to Java
Go to:   
Powered by JForum 2.1.9 © JForum Team
This site run by Scott Dunbar of Xigole Systems. © 2005-2011 - Scott Dunbar
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners
hotjoe.com, xigole.com, and Scott Dunbar have no affiliation with Oracle