![]() |
| ||
| exception in thread main java .lang.NoClassDefFoundError:Abc 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); } } } |
| ||
| Re: exception in thread main java .lang.NoClassDefFoundError:Abc 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? |
| ||
| Re: exception in thread main java .lang.NoClassDefFoundError:Abc Go to where the ".class" file is and type the command as java -cp . Abc |
| ||
| Re: exception in thread main java .lang.NoClassDefFoundError:Abc 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. |
| ||
| Re: exception in thread main java .lang.NoClassDefFoundError:Abc whops, thank you for pointing that out :) |
| ||
| Re: exception in thread main java .lang.NoClassDefFoundError:Abc Quote:
|
| All times are GMT -4. The time now is 1:41 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC