aspose file tools*
The moose likes Beginning Java and the fly likes Help ! This code compiles but does not run: NoClassDefFoundError: Classpath info? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Help ! This code compiles but does not run: NoClassDefFoundError: Classpath info?" Watch "Help ! This code compiles but does not run: NoClassDefFoundError: Classpath info?" New topic
Author

Help ! This code compiles but does not run: NoClassDefFoundError: Classpath info?

Erik carine
Greenhorn

Joined: Jun 30, 2000
Posts: 11
This code compiles but does not run: NoClassDefFoundError
Exact error message:
C:\jdk1.3\bin>java Sum
Exception in thread "main"
java.lang.NoClassDefFoundError : Sum
Am i getting this because i have multiple jdk's
on my computer and that messed up the claspathing?
the Sum file is in the bin dir:
here the file:
//////////////////////////////////////////////////
// this code compiles but it does not run
// the error message i get is java Sum Exception in
// Thread "main" java.lang.NoClassDefFoundError: Sum
// i compile it in the dir D:\jdk.13\bin>
// do i need to set the classpath?
// my email is corradino@collegeclub.com

import javax.swing.JOptionPane;
public class Sum extends Object {

public static void main( String args[] )
{
int sum =0;
for ( int number =1; number <=100; number++)<br /> sum +=number;<br /> <br /> JOptionPane.showMessageDialog( null, " the sum is " + sum,<br /> "Sum integers from 1 to 100",<br /> JOptionPane.INFORMATION_MESSAGE );<br /> System.exit( 0 );<br /> }<br /> }<br /> /////////////////////////////////////////////////////<br /> <br /> I also tried C:\>c:jdk.13\bin\javac -classpath "
C:\jdk1.3\bin;" Sum.java
PS: this error never happened until i installed multiple
jdks and i also uninstalled all of them and reinstalled
jdk1.3 and i still get the same error!
deekasha gunwant
Ranch Hand

Joined: May 06, 2000
Posts: 396
Erik,
i copied ur code in c:\>code directory & then

c:\code>javac Sum.java
c:>code>java Sum
the code compiled and ran perfectly.i'm using jdk 1.2.1 although
even i have installed so many versions of jdk . but in my case there is no problem.
can any body explain this
deekasha

Erik carine
Greenhorn

Joined: Jun 30, 2000
Posts: 11
( I have 2 computers winnt and win98 )
(My question is on making it work on winnt! )
I just did exactly what u did and I still got the same
error message! (on my winnt machine)
In winnt in autoexec.bat file i wrote this
PATH=C:\WINNT;C:\WINNT\COMMAND;C:\JDK1.3\BIN;
AND MY Sum.class file gave me the same error message!
before the path message i also tried putting this in the
autoexe.bat file:
SET PATH=%PATH;%JAVAHOME%\BIN

New Autoexe.bat file for win98
//=============================

SET BLASTER=A220 I7 D1 H7 P330 T6
SET SBPCI=C:\AUDIOPCI
SET QTJava=d:\jdk1.2.1\jre\lib\ext\QTJava.zip

SET CLASSPATH=%BIN%;
SET PATH=C:\JDK1.3\BIN;
SET PATH=%PATH%;C:\PROGRA~1\NETWOR~1\PGP
//========================================

//=======================================
this is the old one
SET BLASTER=A220 I7 D1 H7 P330 T6
SET SBPCI=C:\AUDIOPCI
SET QTJava=d:\jdk1.2.1\jre\lib\ext\QTJava.zip

SET CLASSPATH=%QTJava%;
SET PATH=C:\JAVA\BIN;C:\VIEWER5
SET PATH=%PATH%;C:\PROGRA~1\NETWOR~1\PGP

//=============================================

On win98 it seems like it does not matter!
( Sum works with jdk1.3 " compiles and runs" on my win98)
on my winnt machine the autoexe.bat file was 100%
empty and i still get this NoClassDef error on winnt
with or without an edit autoexec.bat file
gopikrishna
Greenhorn

Joined: Jul 04, 2000
Posts: 3
Try setting path variable as follows
set path = %path%;c:\jdk1.2\bin;c:\jdk1.2\bin;
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help ! This code compiles but does not run: NoClassDefFoundError: Classpath info?
 
Similar Threads
NoClassDefFoundError
NoClassDefFoundError
NoClassDefFoundError
NoClassDefFoundError
NoClassDefFoundError