NoClassDefFoundError

Hi. I have a simple programme:

package WXY;

import java.io.BufferedReader;

import java.io.FileReader;

import java.io.FileNotFoundException;

import java.io.IOException;

import java.io.PrintWriter;

import java.io.FileWriter;

publicclass VSM{

publicstaticvoid main(String[] args)throws FileNotFoundException,

IOException{

BufferedReader in =new BufferedReader(new FileReader(

"C:\\word.txt"));

String word;

word = in.readLine();

in.close();

PrintWriter writer =new PrintWriter(new FileWriter ("C:\\result.txt"));

writer.println(word);

writer.close();

}

}

But when I run it in textpad or using command line, it will throw Exception in thread "main" java.lang.NoClassDefFoundError.

How to slove the problem?

[1567 byte] By [Wenxiaoa] at [2007-10-2 13:29:08]
# 1
Can you post the commad you are using to run your class?Based on that we can makes some assumptions on what the problem might be.
jmguillemettea at 2007-7-13 11:12:19 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 2
Just use the "run java application" in TextPad or type "java myjava" in the command line
Wenxiaoa at 2007-7-13 11:12:19 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 3
Just use the "run java application" in TextPad or type "java VSM" in the command line
Wenxiaoa at 2007-7-13 11:12:19 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 4
You should always post the full exact error message. From the command line, the command should be something likejava -cp . WXY.VSMThis assumes you have a directory named WXY inside the current directory and you place the VSM.class file inside the WXY directory.
atmguya at 2007-7-13 11:12:19 > top of Java-index,Java HotSpot Virtual Machine,Specifications...