manifest - Java is not finding the class -
i have created manifest file:
manifest-version: 1.0 main-class: dicomvalidate.menu class-path: lib/log4j-1.2.16.jar lib/sl4j-api-1.6.4jar lib/sl4j-log4j12-1.6.4.jar lib/dcm4che-audit-2.0.25.jar lib/dcm4che-core-2.0.25.jar lib/dcm4che-image-2.0.25.jar lib/dcm4che-imageio-2.0.25.jar lib/dcm4che-iod-2.0.25.jar lib/dcm4che-net-2.0.2h.jar
when attempt run file in windows command prompt in directory: c:\temp\workspace\dicomvalidate>java -jar dicomvalidate.jar
, error:
view dicom tags enter dicom file path name: c:/ryan.dcm enter tag list: c:/testing.txt exception in thread "main" java.lang.noclassdeffounderror: org/dcm4che2/io/dicominputstream @ dicomvalidator.viewdicomtags.readdicomobject(viewdicomtags.java:40) @ dicomvalidator.menu.showmenu(menu.java:46) @ dicomvalidator.menu.main(menu.java:14) caused by: java.lang.classnotfoundexception: org.dcm4che2.io.dicominputstream @ java.net.urlclassloader$1.run(urlclassloader.java:217) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloader.java:205) @ java.lang.classloader.loadclass(classloader.java:323) @ sun.misc.launcher$appclassloader.loadclass(launcher.java:294) @ java.lang.classloader.loadclass(classloader.java:268) ... 3 more
this should accessing dicominputstream in dcm4che-core-2.0.25.jar
. have no idea why not accessing class have attempted many times , still same result (despite me having made sure spelling , correct). can please me figure out why .jar not getting accessed?
update: have made changes recommended still getting hit same error:
please enter: 1 view dicom tags 2 add dicom tags 3 edit dicom tags 4 exit 1 view dicom tags enter dicom file path name: im-0009-0001.dcm enter tag list: tags.txt exception in thread "main" java.lang.noclassdeffounderror: org/dcm4che2/io/dicominputstream @ dicomvalidator.viewdicomtags.readdicomobject(viewdicomtags.java:40) @ dicomvalidator.menu.showmenu(menu.java:45) @ dicomvalidator.menu.main(menu.java:14) caused by: java.lang.classnotfoundexception: org.dcm4che2.io.dicominputstream @ java.net.urlclassloader$1.run(urlclassloader.java:217) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloader.java:205) @ java.lang.classloader.loadclass(classloader.java:323) @ sun.misc.launcher$appclassloader.loadclass(launcher.java:294) @ java.lang.classloader.loadclass(classloader.java:268) ... 3 more
can please me figure out why not recognizing dicominputstream?????
there several issues in manifest.mf.
first, have several library names incorrect, pointed ctrueden.
second, manifest.mf must not have line longer 72 bytes (see ref).
so in all, manifest.mf should following (tested locally):
manifest-version: 1.0 main-class: dicomvalidate.menu class-path: lib/log4j-1.2.16.jar lib/slf4j-log4j12-1.6.4.jar lib/slf4j -api-1.6.4.jar lib/dcm4che-audit-2.0.25.jar lib/dcm4che-core-2.0.25.j ar lib/dcm4che-image-2.0.25.jar lib/dcm4che-imageio-2.0.25.jar lib/dc m4che-iod-2.0.25.jar lib/dcm4che-net-2.0.25.jar
finally, recommended others, should use maven. here's pom file should build jar want.
<?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>tmp</groupid> <artifactid>tmp2</artifactid> <version>0.0.1-snapshot</version> <packaging>jar</packaging> <properties> <project.build.sourceencoding>utf-8</project.build.sourceencoding> <maven.compiler.source>1.7</maven.compiler.source> <maven.compiler.target>1.7</maven.compiler.target> </properties> <repositories> <repository> <id>dcm4che</id> <url>http://www.dcm4che.org/maven2/</url> </repository> </repositories> <dependencies> <dependency> <groupid>log4j</groupid> <artifactid>log4j</artifactid> <version>1.2.16</version> </dependency> <dependency> <groupid>org.slf4j</groupid> <artifactid>slf4j-log4j12</artifactid> <version>1.6.4</version> </dependency> <dependency> <groupid>org.slf4j</groupid> <artifactid>slf4j-api</artifactid> <version>1.6.4</version> </dependency> <dependency> <groupid>dcm4che</groupid> <artifactid>dcm4che-audit</artifactid> <version>2.0.25</version> </dependency> <dependency> <groupid>dcm4che</groupid> <artifactid>dcm4che-core</artifactid> <version>2.0.25</version> </dependency> <dependency> <groupid>dcm4che</groupid> <artifactid>dcm4che-image</artifactid> <version>2.0.25</version> </dependency> <dependency> <groupid>dcm4che</groupid> <artifactid>dcm4che-imageio</artifactid> <version>2.0.25</version> </dependency> <dependency> <groupid>dcm4che</groupid> <artifactid>dcm4che-iod</artifactid> <version>2.0.25</version> </dependency> <dependency> <groupid>dcm4che</groupid> <artifactid>dcm4che-net</artifactid> <version>2.0.25</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-jar-plugin</artifactid> <version>2.6</version> <configuration> <archive> <manifest> <addclasspath>true</addclasspath> <mainclass>dicomvalidate.menu</mainclass> </manifest> </archive> </configuration> </plugin> </plugins> </build> </project>
Comments
Post a Comment