exception in thread main java .lang.NoClassDefFoundError:Abc

Reply

Join Date: Jun 2009
Posts: 1
Reputation: manveet is an unknown quantity at this point 
Solved Threads: 0
manveet manveet is offline Offline
Newbie Poster

exception in thread main java .lang.NoClassDefFoundError:Abc

 
0
  #1
Jul 3rd, 2009
import java.io.*;
class Abc
{
public static void main(String arg[])
{
try{
File f= new File("c:/xyz.txt");
FileOutputStream fout=new FileOutputStream(f);
byte data[]={65,66,67,68};
fout.write(data);
fout.close();}
catch(Exception e)
{
System.out.println(e);
}
}
}
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 53
Reputation: di2daer is an unknown quantity at this point 
Solved Threads: 12
di2daer's Avatar
di2daer di2daer is offline Offline
Junior Poster in Training

Re: exception in thread main java .lang.NoClassDefFoundError:Abc

 
0
  #2
Jul 3rd, 2009
You're missing an import statement for FileOutputStream, other than that, I can't spot any errors with this code. I think you'll have to explain a bit more about when you get this error. In what context are you using it?
---------------------------
333 - halfway to hell
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 2,358
Reputation: masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of 
Solved Threads: 252
Moderator
masijade's Avatar
masijade masijade is offline Offline
Nearly a Posting Maven

Re: exception in thread main java .lang.NoClassDefFoundError:Abc

 
0
  #3
Jul 3rd, 2009
Go to where the ".class" file is and type the command as java -cp . Abc
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 2,612
Reputation: adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of 
Solved Threads: 463
Moderator
adatapost's Avatar
adatapost adatapost is offline Offline
Posting Maven

Re: exception in thread main java .lang.NoClassDefFoundError:Abc

 
1
  #4
Jul 3rd, 2009
A mistake by di2daer.

You're missing an import statement for FileOutputStream.

When we use java.io.*; It means any class/interface of java.io package can be used in our program file without qualify it with java.io package name.
Last edited by adatapost; Jul 3rd, 2009 at 8:18 am.
Failure is not fatal, but failure to change might be. - John Wooden
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 53
Reputation: di2daer is an unknown quantity at this point 
Solved Threads: 12
di2daer's Avatar
di2daer di2daer is offline Offline
Junior Poster in Training

Re: exception in thread main java .lang.NoClassDefFoundError:Abc

 
0
  #5
Jul 3rd, 2009
whops, thank you for pointing that out
---------------------------
333 - halfway to hell
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 2,612
Reputation: adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of 
Solved Threads: 463
Moderator
adatapost's Avatar
adatapost adatapost is offline Offline
Posting Maven

Re: exception in thread main java .lang.NoClassDefFoundError:Abc

 
0
  #6
Jul 3rd, 2009
Originally Posted by di2daer View Post
whops, thank you for pointing that out
You are welcome.
Failure is not fatal, but failure to change might be. - John Wooden
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC