[ https://issues.apache.org/jira/browse/COMPRESS-673?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17827788#comment-17827788 ]
Gary D. Gregory commented on COMPRESS-673: ------------------------------------------ Using Maven to manage your dependencies will build the proper classpath for you; that and the assembly plugin can build a deliverable for your app. > ArchiveStreamFactory().createArchiveOutputStream throws class not found > exception > --------------------------------------------------------------------------------- > > Key: COMPRESS-673 > URL: https://issues.apache.org/jira/browse/COMPRESS-673 > Project: Commons Compress > Issue Type: Bug > Components: Archivers > Environment: Mac OS X > Reporter: kranthi > Priority: Major > > From common-compress 1.26.0 onwards, createArchiveOutputStream throws > java.lang.ClassNotFoundException exception > > My Code: > ------------------- > Path f = Paths.get("/Users/kraas/Documents/test.jar"); > ArchiveOutputStream jos = new > ArchiveStreamFactory().createArchiveOutputStream(ArchiveStreamFactory.ZIP, > Files.newOutputStream(f)); > --------------------- > The above code, does not throw an error and completes successfully with > commons-compress-1.24.0.jar > But starting from commons-compress-1.26.0.jar, below exception is thrown > Exception in thread "main" java.lang.NoClassDefFoundError: > org/apache/commons/io/Charsets > at > org.apache.commons.compress.archivers.zip.ZipEncodingHelper.getZipEncoding(ZipEncodingHelper.java:51) > at > org.apache.commons.compress.archivers.zip.ZipEncodingHelper.<clinit>(ZipEncodingHelper.java:37) > at > org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.<init>(ZipArchiveOutputStream.java:332) > at > org.apache.commons.compress.archivers.ArchiveStreamFactory.createArchiveOutputStream(ArchiveStreamFactory.java:518) > at > org.apache.commons.compress.archivers.ArchiveStreamFactory.createArchiveOutputStream(ArchiveStreamFactory.java:500) > at work.ArchiveExample.compressZip(ArchiveExample.java:26) > at work.ArchiveExample.main(ArchiveExample.java:18) > Caused by: java.lang.ClassNotFoundException: org.apache.commons.io.Charsets > at > java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) > at > java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) > at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520) > ... 7 more -- This message was sent by Atlassian Jira (v8.20.10#820010)