-
Website
http://www.tech-recipes.com/ -
Original page
http://www.tech-recipes.com/rx/826/java-exception-in-thread-main-javalangnoclassdeffounderror/ -
Subscribe
All Comments -
Community
-
Top Commenters
-
davak
83 comments · 1 points
-
Web Design
3 comments · 1 points
-
danishbacker
9 comments · 1 points
-
flexinfo
11 comments · 1 points
-
Tonychelle
4 comments · 1 points
-
-
Popular Threads
-
Facebook: How To Get Only Status Updates on Your FB Home Page
1 week ago · 4 comments
-
Firefox: Enable Case Sensitive Searches When Using Find (Ctrl+F)
5 days ago · 1 comment
-
Windows 7: How To Disable Live Preview for Taskbar Thumbnails
2 weeks ago · 2 comments
-
Gmail: How to block a sender from your inbox
3 weeks ago · 3 comments
-
Our first iPhone game GreenThumb available in the App Store
4 weeks ago · 2 comments
-
Facebook: How To Get Only Status Updates on Your FB Home Page
.;C:\Program Files\Java\jdk1.6.0_01\lib
set path=.....
and for classes
set classpath=....
i just copied my files in bin dir. try doing this.
java -classpath . XYZ
didn't work for me ...
any idea ?? :'(
wassalam
Copyright (c) 2006 Microsoft Corporation. All rights reserved.
C:\Users\mdube>cd\
C:\>javac C:\abhishek\Mohit.java
C:\>java C:\abhishek\mohit
Exception in thread "main" java.lang.NoClassDefFoundError: C:\abhishek\mohit
C:\>java C:\abhishek/mohit
Exception in thread "main" java.lang.NoClassDefFoundError: C:\abhishek/mohit
C:\>javac C:\abhishek/Mohit.java
C:\>$Recycle.Bin
'$Recycle.Bin' is not recognized as an internal or external command,
operable program or batch file.
C:\>JAVAC
Usage: javac <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are us
ed
-classpath <path> Specify where to find user class files
-sourcepath <path> Specify where to find input source files
-bootclasspath <path> Override location of bootstrap class files
-extdirs <dirs> Override location of installed extensions
-d <directory> Specify where to place generated class files
-encoding <encoding> Specify character encoding used by source files
-source <release> Provide source compatibility with specified release
-target <release> Generate class files for specific VM version
-help Print a synopsis of standard options
C:\>JAAVA
But some of the best environment to program java in would have to be Eclipse or NetBeans.
They have an awful lot of features, and is very easy to use when you get over the initial general troubles, such as which features to use, and getting an overview of all the stuff they can do.
.;C:\Program Files\Java\jdk1.5.0_01\lib
1. for JDK use following command
set path=C:\......
2. for classes where u compiled and kept
set classpath=D:\prgrams......
Exception in thread "main" java.lang.UnsupportOperationException at sun.jdbc.odbc.jdbcOdbcConnection.createStatement(Unknown Source)
at DBConn.<init><DBConn.java,Compiled Code>
at ReceiveMail.<init><Receivemail.java,Compiled Code>
at insertion.main(insertion.java:10)
C:\Program Files\Java\jdk1.6.0_10\jre\lib;C:\Program Files\Java\jdk1.6.0_10\jre\bin;C:\novell\ndk\ndssdk\java\lib\ldap.jar;.;C:\JavaProjects\SearchLDAPTest
Where C:\JavaProjects\SearchLDAPTest is where my List.class compiled class resides
I also created JAVA_HOME Variable for my user with a value of:
C:\Program Files\Java\jdk1.6.0_10\
and finally I have for my Path:
C:\Program Files\Java\jdk1.6.0_10\jre\bin;D:\Program Files\SSH Communications Security\SSH Secure Shell;C:\Program Files\Java\jdk1.6.0_10\bin\javac.exe;C:\novell\ndk\njclv2r\src\njcl
Which C:\Program Files\Java\jdk1.6.0_10\jre\bin is the bin of the RUNTIME or should I also list C:\Program Files\Java\jdk1.6.0_10\bin :: the JDK bin/ instead ?
anyone with any CLEAR ideas ? thx
My program is compiling but when i run it gives me an error
java.lang.NoClassDefFoundError:
Exception in thread "main"
Tool completed with exit code 1
I have set my path to C:\jdk1.3\bin
and the classpath to where the program reside but in vein can anybody help
it keeps saying that java.lang.noclassdeffounderror thing...
i run small prgm, my error is
exception in thread "main" java.lang.noclassdefFoundError
how do clear my error
When I copied the .java file to my hard drive the problem went away
i o u big!!!
ty for suggesting at putting that in the Class path file, a program of mine has been corrupted for over 2 yrs, and i tried to fix it 1 last time, and ur suggestion worked!!
ty!!
The .Java and the .Class file is located in C:\Java . i got the above error and changed directory at the dos prompt by typing
cd Java (Enter)
Then I compiled by typing the below
C:\Java>"C:\Program Files\Java\jdk1.5.0_16\bin\javac.exe" C:\java\saluton.java
Than I run by typing the below
C:\Java>java Saluton
Results ...
Saluton Mundo!
Hope this Helps . Arichards
java -classpath . m
i get this........
Unrecognized option: -classpath.m
Could not create the Java virtual machine.
help is appreciated!!!1
like java -classpath[space].[space]m
mine was also having the same error but when i gave spacing between them it worked,,..so u can also try dis once...
too , i have error :
Exception in thread "main" java.lang.NoClassDefFoundError: nameclass
help me.
I got this error when i made the mistake of running the class file. Make sure you are running the job correctly (fyi, I'm running vista):
Correct: C:\Users\Crimson\teaching> java Example
Incorrect: C:\Users\Crimson\teaching> java Example.class
This is really easy to forget about, especially if you're used to using an IDE like Eclipse, which was the case for me. I scratched my head for a little while and feel really dumb now.
for me i didnt put a space after java and a space either side of the full stop. and i forgot to write my class with an upper case letter which is how it was saved.
java(space) -classpath(space) . (space)Welcome1
Caused by: java.lang.ClassNotFoundException: Receiver.class
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: Receiver.class. Program will exit.
where Receiver is my class..code is getting compiled perfectly but when i run its givin the above error..
First set the JAVA_HOME variable with your bin directory.
then try to run .it will help u.
Regards
Ram Yadav
error is java.lang.NoClassDefFoundError: and im using jdk 1.6 version .
someone helpout this
It worked great
anyone help?
I just followed every suggestion in this string and no dice...
FINALLY I GOT IT ----> (on Windows XP) MAKE SURE YOU COMPILE YOUR PROGRAM WITH C:\...javac ClassName.java before you try to execute with C:\...java ClassName
You will know your program is compiled when you find a ClassName.class file in the same folder as your original ClassName.java program.
Hope this helps the last desperate few.
And yes, of course, make sure your path and classpath are correctly configured.
java HelloWorld.class
java is expecting a class so the .class suffix is not necessary
of course your class path might be wrong also ;-)
If you are also dependent on a jar file in the same folder you may need to have something like
java -classpath .;./dependent.jar helloworld
i am so glad that my problem has been solved...
THANK YOU again :)
It would probably help if you explicity indicate that the extension ".class" should not be used when using "-classpath" .
my bad.. lol
we can run the programm by using diffrn style..
like
java -cp . className
Try removing any "package" from the top of your *.java files.
I had set the Classpath for the dependency jar and the Java_HOME = C:\Program Files\Java\jdk1.5.0_20\bin
C:\Program Files\DDEForJava\examples\com\javaparts\dde\examples>java -cp . Excel
Async
Exception in thread "main" java.lang.UnsupportedClassVersionError: ExcelAsync (U
nsupported major.minor version 49.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
3)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
Any help would be appreciated//
Thanks
Shelli
Exception in thread "main" java.lang.UnsupportedClassVersionError: HelloWorld (U
nsupported major.minor version 50.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
C:\javaprog>
java -classpath . helloworld' ?
where / how do i execute with another classpath?
java helloworld.class
Instead try to run:
java helloworld
set classpath = .;M:\;C:\Program Files\Java\jre1.6.0_14\bin;
is NOT the same as:
set classpath=.;M:\;C:\Program Files\Java\jre1.6.0_14\bin;
If you put spaces around the '=' it won't work. The file would always compile but would only run without the package designation. As soon as I added the 'package' statement at the top I could compile it but it would always give the above error when I tried to run it. Hope this helps someone.
I have installed red5 server on my machine and also JDK version of 1_5_0_11
java -classpath C:\Program Files\Red5\red5.jar F:\Video Chat\red5chatv2.1\JAVA-RED5\src\chat\application.java
but when I tryed to compile to get my application.class file using above shown command on command promt I got error : Exception in thread "main" java.lang.NoClassDefFoundError: Files\Red5\red5/jar
at org.apache.xalan.processor.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:823)
at com.pg.EDICustomize.EDISplit204.generateTarget(EDISplit204.java:353)
at com.pg.EDICustomize.EDISplit204.execute(EDISplit204.java:99)
at com.pg.EDICustomize.EDISplit204.main(EDISplit204.java:392)
Caused by: java.lang.ClassNotFoundException: org.apache.xml.serializer.TreeWalker
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
... 4 more
Java Result: 1
BUILD SUCCESSFUL (total time: 2 seconds)
i got this error please help me to resolve this