I am trying to install Mooshak which is distributed as a .jar installer. When I run the file, it gives me the following error about a missing class:
ifinlay@mooshak:~$ sudo java -jar MooshakInstaller.jar -cui
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/compress/archivers/ArchiveException
at pt.up.fc.dcc.mooshak.installer.Installer.<init>(Installer.java:26)
at pt.up.fc.dcc.mooshak.installer.Installer.main(Installer.java:52)
... 5 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.compress.archivers.ArchiveException
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:436)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 7 more
So it can't find the org/apache/commons/compress/archivers/ArchiveException class. But I have installed this library and have the following in my CLASSPATH:
ifinlay@mooshak:~$ echo $CLASSPATH
.:/usr/share/maven-repo/org/apache/commons/commons-compress/1.18/commons-compress-1.18.jar
And this .jar file in the CLASSPATH does seem to contain the class in question:
ifinlay@mooshak:~$ jar tvf /usr/share/maven-repo/org/apache/commons/commons-compress/1.18/commons-compress-1.18.jar
# ... other classes edited out
722 Fri Mar 01 16:57:28 UTC 2019 org/apache/commons/compress/archivers/ArchiveException.class
# ... other classes edit out
So why can Java not find this class when it does seem to be in the path? Any help would be so awesome, I'm really scratching my head at this.
Thanks for reading!
EDIT: The Manifest file for the .jar looks like this:
Manifest-Version: 1.0
Rsrc-Class-Path: ./ junit.jar org.hamcrest.core_1.3.0.v201303031735.ja
r commons-compress-1.12.jar BrowserLauncher2-all-1_3.jar
Class-Path: .
Rsrc-Main-Class: pt.up.fc.dcc.mooshak.installer.Installer
Main-Class: org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader
So this seems to imply that the commons-compress-1.12.jar file should just be placed in the same directory as the installer. This doesn't seem to work though...