Error: Could not find or load main class ExcelReadWrite

Error: Could not find or load main class ExcelReadWrite

我有一个 class ExcelReadWrite 运行 当我 运行 它通过 eclipse.But 当我尝试从命令行 运行 它时 运行 它很好需要设置 class依赖 classes.

的路径
set CLASSPATH=C:\Users\NICSI\.m2\repository\org\apache\poi\poi-ooxml.11\poi-ooxml-3.11.jar;C:\Users\NICSI\.m2\repository\org\apache\poi\poi.11\poi-3.11.jar;

在设置 class 路径后它编译成功但是当我执行我的 class 然后这个异常发生了。

Error: Could not find or load main class ExcelReadWrite

 public class ExcelReadWrite {

public static void main(String[] args) {
    String inputFile=args[0];
    String outputFile=args[1];
    System.out.println("inputFile 0   "+inputFile);
    System.out.println("outputFile 0   "+outputFile);
    transformExcelFile(inputFile,outputFile);
    //transformExcelFile("E:\excel\inputFile.xlsx","E:\excel\outputFile.xlsx");
    }
    }

我使用下面的命令来编译和执行我的class

E:\excelTest>javac ExcelReadWrite.java

E:\excelTest>java ExcelReadWrite
Error: Could not find or load main class ExcelReadWrite

您必须将实际目录添加到类路径中:

E:\excelTest>java -cp .;%CLASSPATH% ExcelReadWrite