|
|
|
|
Re: Exception in thread "main" java.lang.NoClassDefFoundError [message #91295 is a reply to message #91289] |
Wed, 03 July 2002 06:19 |
JavPlam
Messages: 1 Registered: July 2002
|
Junior Member |
|
|
Hi, I had the same problem after installing J2SDK1.4.0_01. But I also fixed it by adding the current /bin directory to my classpath:
I just inserted an additional row in the autoexec.bat
"SET CLASSPATH=c:j2sdk1.4.0_01BIN" , saved the file and run c:autoexec.bat
After that everything was OK.
Hope it helps.
|
|
|
|
|
|
|
Re: Exception in thread [message #91345 is a reply to message #91179] |
Tue, 23 July 2002 12:04 |
Ishai
Messages: 1 Registered: July 2002
|
Junior Member |
|
|
I have the c:jdkbin in my path but it still doesnt work , can someone
help me out ?
i cant run any program :-\
and plz write the full explaination because otherwise its hard to understand what your writing .
|
|
|
|
Re: Exception in thread "main" java.lang.NoClassDefFoundError [message #91442 is a reply to message #91179] |
Mon, 09 September 2002 02:45 |
Prabhu
Messages: 26 Registered: October 2001
|
Junior Member |
|
|
The Error Message
"Exception in thread "main" java.lang.NoClassDefFoundError:" is because the JVM is not able to locate the Class file which you are trying to Run (though you are in the Directory where your class file is placed.)
To solve this issue the solution is set the CLASSPATH variable to your current directory(Open Command prompt key in the following and press Enter
"Set Classpath=%Classpath%;.;
|
|
|
Re: Exception in thread "main" java.lang.NoClassDefFoundError [message #91448 is a reply to message #91179] |
Tue, 10 September 2002 06:33 |
David
Messages: 110 Registered: November 1998
|
Senior Member |
|
|
I installed J2SDK1.4.0 and J2EE server also. When I run
the simple program just "HelloWorld", I got the
error like that
Exception in thread "main" java.lang.NoClassDefFoundError : HelloWorld
Did you get the solution for this problem I set classpath to the bin and Lib directory and nothing happen I am running J2sdk1.4 on windows2000 professional
|
|
|
Exception in thread "main" java.lang.NoClassDefFoundError [message #91450 is a reply to message #91179] |
Tue, 10 September 2002 21:36 |
Brian
Messages: 38 Registered: October 1999
|
Member |
|
|
Hi
I have installed j2sdk-1_3_1_02 under windows ME OS.
I just run a simple HelloWorld program but keep getting
the message Exception in thread "main" java.lang.NoClassDefFoundError. I set my environment like this:
PATH=C:jdk1.3.1_02bin;
CLASSPATH=C:jdk1.3.1_02lib;
JAVA_HOME=C:jdk1.3.1_02bin;
Please help me to solve this problem. Thank
|
|
|
|
|
|
Re: Exception in thread "main" java.lang.NoClassDefFoundError [message #91460 is a reply to message #91179] |
Wed, 18 September 2002 10:38 |
Diana Benobo
Messages: 1 Registered: September 2002
|
Junior Member |
|
|
If you are using NT 2000 ...
Try these with attention to case:
java -cp myjar.jar myapplet
java -cp c:myclassesmyjar.jar myapplet
java -cp myjar.jar mypackage.myapplet
java -cp c:myclassesmyjar.jar mypackage.myapplet
Setting the classpath variable on NT 2000 didn't seem to help me to shorten the path for the -cp variable unless I set the classpath to specifically to the jar itself, as follows:
set classpath=c:myclassesmyjar.jar
or possibly
set classpath=c:myclassesmyjar;%classpath%
If you set a classpath environmental variable by using the command line above, don't use spaces on either side of the equals sign. The set command will interpret the space as a character.
Note: Be sure to observe the case of the classpath variable name ( CLASSPATH, classpath, ClassPath, etc.)
before you set the classpath or else you may end up with two classpath variables.
|
|
|
|
|
|
|
|
|
% [message #91504 is a reply to message #91179] |
Sat, 12 October 2002 06:23 |
Peter
Messages: 62 Registered: August 2000
|
Member |
|
|
I have got some problem whit (%).
I donīt know how it dose work.
tanks
Peter
|
|
|
Re: Exception in thread "main" java.lang.NoClassDefFoundError (win 2000) [message #91508 is a reply to message #91179] |
Tue, 15 October 2002 03:47 |
Claudio Joao
Messages: 1 Registered: October 2002
|
Junior Member |
|
|
I just installed j2sdk1.4.1 on my windows 2000 machine.
My CLASSPATH now looks like this "C:j2sdk1.4.1libtools.jar;.;" and it works nice.
However if you place the current directory "." BEFORE "C:j2sdk1.4.1libtools.jar" it stops working and I'm back to those
"java.lang.NoClassDefFoundError" errors again.
Must be a windows feature.So try with the "." at the end of the CLASSPATH
It worked for me I hope it works for you.
Claudio
|
|
|
|
|
|
|
Re: Exception in thread "main" java.lang.NoClassDefFoundError [message #91671 is a reply to message #91442] |
Mon, 06 January 2003 17:13 |
Lakshmi mandaleeka
Messages: 1 Registered: January 2003
|
Junior Member |
|
|
Your JAVA_HOME should be set to JAVA_HOME=C:jdk1.3.1_02; not JAVA_HOME=C:jdk1.3.1_02bin;
Thats one of the problems.
CLASSPATH need not be set to C:jdk1.3.1_02lib; from 1.3. This is an old convention, however u need to set it to your current dir or directory where your .class has been compiled to.
The above changes should resolve your problem.
|
|
|
|
|
|
Re: Exception in thread "main" java.lang.NoClassDefFoundError [message #91741 is a reply to message #91179] |
Wed, 29 January 2003 01:47 |
Karthik Durai
Messages: 2 Registered: December 2002
|
Junior Member |
|
|
Set Ur program name in Classpath.
EX:
My program name is DB1.java. I run like this
1) c:karthikwrkjavajava DB1
--> It gave java.lang.NoClassDefFoundError
SOLUTION;
2) Then i set this in my classpath
-->C:karthikwrkjava>set CLASSPATH=%CLASSPATH%;c:oraclejdbclibclasses12.zip;c:karthikwrkjava;
Now it is working fine.
--Karthik
|
|
|
|
Re: Exception in thread "main" java.lang.NoClassDefFoundError [message #91746 is a reply to message #91179] |
Thu, 30 January 2003 14:31 |
Brad Sorensen
Messages: 1 Registered: January 2003
|
Junior Member |
|
|
WINDOWS 2000
************************************
STEP ONE
Locate the BIN directory in the sdk version you are using
(I installed j2ee and j2se and ant)
MY LOCATIONS:
(J2SE) C:j2sdk_1.4.1_01bin
(J2EE) C:j2sdkee1.4bin
(ant) C:jakarta-ant-1.3bin
************************************
************************************
STEP TWO
Under Start | Settings | Control Panel, Double click 'System'
Navigate to the 'Advanced Tab' and select 'Environmental Variables'
- Under 'System Variables' Select CLASSPATH and click EDIT
- add ';.' to the end of the string already there.
- Click 'OK'
- Under 'System Variables' select PATH and click EDIT
- add ';C:j2skd1.4.1_01/bin;C:j2skdee1.4bin;C:jakarta-ant-1.3bin;' (or just the sdk you are using) to the end of the string already there.
- Click 'OK'
************************************
If that doesn't work,
Cry
Brad
|
|
|
Alternate way to execute your program [message #91748 is a reply to message #91179] |
Fri, 31 January 2003 09:40 |
SamIAm
Messages: 1 Registered: January 2003
|
Junior Member |
|
|
Have you set your path and classpath environment variables and your application is still not executing without the error message? Consider, then, another way of executing your application.
Instead of just running it like this:
c:JavaSourceDirectory>java HelloWorld
Try this:
c:JavaSourceDirectory>java -classpath . HelloWorld
the -classpath switch sets the search path for application classes and resources. In this example, it's set to "." which is the current directory.
You can activate the -classpath switch during compilation (when you run "javac") and execution (when you run "java"), but on execution you can abbreviate it to "-cp":
c:JavaSourceDirectory>java -cp . HelloWorld
I use j2sdk1.4.1_01 on an NT platform, and this worked for me. Hope it works for you.
|
|
|
|
|