Monday, May 3, 2010

Re: [Java] NoClassDefFoundError exception

 

Hello
This message tells you that there is no class named first.class.

ex:
1- source code
class First  //  no public and capital letter F
{

system.out.println("Hello world");

}

2- save source code in file named first.java // note small letter f
3- compile it
4- output of compilation will be First.class // capital F as source code not small f as file name

5- so , you must use capital Letter "java First" because there is no file named first.class with small f

also, if you want make a class pulbic you must name the file as source code with capital F
also, only one class in the same file can be made public

--- On Sun, 4/25/10, krunal bhatt <bhatt.krunal@gmail.com> wrote:

From: krunal bhatt <bhatt.krunal@gmail.com>
Subject: [Java] NoClassDefFoundError exception
To: Java_Official@yahoogroups.com
Date: Sunday, April 25, 2010, 6:58 AM

 

Hello friends,

i installed jdk1.6.5_05 and jre1.6.5_05 in my system and just to check

whether the installation is ok or not i wrote a simple "Hello World". When i

compile it using javac , it shows no error but when i run the program i get

the following error.

D:\projects\ Java_Projects> *javac first.java*

D:\projects\ Java_Projects> *java first*

*Exception in thread "main" java.lang.NoClassDe fFoundError: first

Caused by: java.lang.ClassNotF oundException: first

at java.net.URLClassLo ader$1.run( Unknown Source)

at java.security. AccessController .doPrivileged( Native Method)

at java.net.URLClassLo ader.findClass( Unknown Source)

at java.lang.ClassLoad er.loadClass( Unknown Source)

at sun.misc.Launcher$ AppClassLoader. loadClass( Unknown Source)

at java.lang.ClassLoad er.loadClass( Unknown Source)

at java.lang.ClassLoad er.loadClassInte rnal(Unknown Source)

*D:\projects\ Java_Projects>

please provide solution for this..

--

Regards,

Krunal Bhatt

[Non-text portions of this message have been removed]

[Non-text portions of this message have been removed]

__._,_.___
Recent Activity:
Visit http://aiaiai.com or http://jgame.org for more groups to join.
Java Official Group is created for the following topics: Java 2 Enterprise Edition - J2EE, Java 2 Standard Edition - J2SE, Java 2 Micro Edition - J2ME, XML, XSL, XSD, XPATH, Web Services, Jini, JXTA for all type of Java Geeks.
Whoever posts spam / ads / job related message will be BANNED IMMEDIATELY
.

__,_._,___

No comments:

Post a Comment