Error integrating box java sdk
I have a sample build.gradle file, containing the following:
group 'box' version '1.0-SNAPSHOT' apply plugin: 'java' apply plugin: 'application' sourceCompatibility = 1.8 repositories { mavenCentral() } dependencies { compile 'com.box:box-java-sdk:2.11.0' } // Define the main class for the application mainClassName = 'Main' jar { manifest { attributes "Main-Class": "$mainClassName" } //this way it works // from (configurations.compile.collect { entry -> zipTree(entry) }) { // exclude 'META-INF/MANIFEST.MF' // exclude 'META-INF/*.SF' // exclude 'META-INF/*.DSA' // exclude 'META-INF/*.RSA' // } //this one doesnt work from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } }
and a short Main class, containing:
public class Main { public static void main(String[] args) { System.out.println("Hello world!"); } }
Now, if we look at the from closure, inside jar one, I have two ways of getting the sources. The first one works and the second one doesn't.
Could someone clarify why I need to exclude all those files?
The error I get is the following:
Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.SecurityException: Invalid signature file digest for Manifest main attributes at sun.security.util.SignatureFileVerifier.processImpl(SignatureFileVerifier.java:330) at sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:263) at java.util.jar.JarVerifier.processEntry(JarVerifier.java:275) at java.util.jar.JarVerifier.update(JarVerifier.java:230) at java.util.jar.JarFile.initializeVerifier(JarFile.java:383) at java.util.jar.JarFile.getInputStream(JarFile.java:450) at sun.misc.URLClassPath$JarLoader$2.getInputStream(URLClassPath.java:977) at sun.misc.Resource.cachedInputStream(Resource.java:77) at sun.misc.Resource.getByteBuffer(Resource.java:160) at java.net.URLClassLoader.defineClass(URLClassLoader.java:454) at java.net.URLClassLoader.access$100(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:368) at java.net.URLClassLoader$1.run(URLClassLoader.java:362) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:361) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:495)
The commands I run are:
I have installed the gradle wrapper with: gradle wrapper --gradle-version 4.5
Then I do
./gradlew clean build
java - jar build/libs/hello-world-1.0-SNAPSHOT.jar
I am running java 8.
サインインしてコメントを残してください。
コメント
1件のコメント