不能通过命令行运行Java程序,但可以使用Eclipse运行

不能通过命令行运行Java程序,但可以使用Eclipse运行,java,Java,当我将DICOM图像从DICOM转换为jpg时,当我通过CMD运行这个Java程序时,出现以下错误 ,但当我在eclipse中运行相同的程序时,它运行得很好 错误: log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. Exception in thread "main" org.dcm4che2.data.ConfigurationError: No Image

当我将DICOM图像从DICOM转换为jpg时,当我通过CMD运行这个Java程序时,出现以下错误 ,但当我在eclipse中运行相同的程序时,它运行得很好

错误:

log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" org.dcm4che2.data.ConfigurationError: No Image Reader of class com.sun.media.imageioimpl.plugins.jpeg.CLibJPEGImageReader available for format:jpeg
    at org.dcm4che2.imageio.ImageReaderFactory.getReaderForTransferSyntax(ImageReaderFactory.java:99)
    at org.dcm4che2.imageioimpl.plugins.dcm.DicomImageReader.initCompressedImageReader(DicomImageReader.java:410)
    at org.dcm4che2.imageioimpl.plugins.dcm.DicomImageReader.initImageReader(DicomImageReader.java:395)
    at org.dcm4che2.imageioimpl.plugins.dcm.DicomImageReader.read(DicomImageReader.java:636)
    at DICOMToJPEGConverter.main(DICOMToJPEGConverter.java:26)

当您从eclipse项目运行时,请检查构建路径中的所有库

在尝试运行程序时,可以使用java命令提供所有库

当您执行java时,它会在类路径中查找库的可用性。所以,如果您将这些库添加到类路径中,它将起作用

要从命令行添加这些库,请执行以下操作:

java -cp <all_the_libraries> <programe_to_execute>
java-cp

当您在命令行中运行Eclipse中的构建路径/classpath中的库时,它不在您的类路径中。如何找到在命令行中使用的库