airlift / aircompressor

A port of Snappy, LZO, LZ4, and Zstandard to Java
Apache License 2.0
566 stars 112 forks source link

JNI error #85

Closed amerolla closed 6 years ago

amerolla commented 6 years ago

I tried running: java -cp aircompressor-0.12-SNAPSHOT-tests.jar io.airlift.compress.benchmark.CompressionBenchmark

Got the following error: Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.NoClassDefFoundError: org/openjdk/jmh/runner/options/Options at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) at java.lang.Class.privateGetMethodRecursive(Class.java:3048) at java.lang.Class.getMethod0(Class.java:3018) at java.lang.Class.getMethod(Class.java:1784) at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:522) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:504) Caused by: java.lang.ClassNotFoundException: org.openjdk.jmh.runner.options.Options at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

amerolla commented 6 years ago

Is there a dependency I need to add to the pom.xml file?

martint commented 6 years ago

You need to use mvn exec to run run from the CLI so that it adds all the dependencies to the classpath. E.g.:

mvn exec:exec -Dexec.classpathScope=test -Dexec.executable="$JAVA_HOME/bin/java" -Dexec.args="-XX:+UseG1GC -cp %classpath io.airlift.compress.benchmark.CompressionBenchmark -p algorithm=airlift_lz4 -i 20 -wi 20 -f 10"

The options after CompressionBenchmark are standard JMH args, so adjust as necessary to control parameters, warmup/measurement iterations, etc.

amerolla commented 6 years ago

Thank you very much Martin, I'm running now.

On Wed, Aug 15, 2018 at 3:58 PM, Martin Traverso notifications@github.com wrote:

You need to use mvn exec to run run from the CLI so that it adds all the dependencies to the classpath. E.g.:

mvn exec:exec -Dexec.classpathScope=test -Dexec.executable="$JAVA_HOME/bin/java" -Dexec.args="-XX:+UseG1GC -cp %classpath io.airlift.compress.benchmark.CompressionBenchmark -p algorithm=airlift_lz4 -i 20 -wi 20 -f 10"

The options after CompressionBenchmark are standard JMH args, so adjust as necessary to control parameters, warmup/measurement iterations, etc.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/airlift/aircompressor/issues/85#issuecomment-413316753, or mute the thread https://github.com/notifications/unsubscribe-auth/Ae4U0ptKkADbcCgvIpY3naQ1gNN0z78dks5uRH1igaJpZM4V-h8s .