Javacpp-presets: UnsatisfiedLinkError: no avutil in java.library.path

Created on 11 Apr 2020  路  3Comments  路  Source: bytedeco/javacpp-presets

Hello, I am just trying to run the sample code in README but it is not working. All I did was configuring the pom.xml and copying and pasting the source code just so I can start working on my case project. Everything is fine and no warnings/errors for unresolved dependencies but when I run the sample code I get the stacktrace below where line 38 is AVFormatContext fmt_ctx = new AVFormatContext(null);

Exception in thread "main" java.lang.UnsatisfiedLinkError: no jniavutil in java.library.path: [/Users/batuhan/Library/Java/Extensions, /Library/Java/Extensions, /Network/Library/Java/Extensions, /System/Library/Java/Extensions, /usr/lib/java, .]
    at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2660)
    at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:827)
    at java.base/java.lang.System.loadLibrary(System.java:1902)
    at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:1302)
    at org.bytedeco.javacpp.Loader.load(Loader.java:1043)
    at org.bytedeco.javacpp.Loader.load(Loader.java:935)
    at org.bytedeco.javacpp.avutil.<clinit>(avutil.java:10)
    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Class.java:415)
    at org.bytedeco.javacpp.Loader.load(Loader.java:994)
    at org.bytedeco.javacpp.Loader.load(Loader.java:935)
    at org.bytedeco.javacpp.avformat$AVFormatContext.<clinit>(avformat.java:2882)
    at Main.main(Main.java:38)
Caused by: java.lang.UnsatisfiedLinkError: no avutil in java.library.path: [/Users/batuhan/Library/Java/Extensions, /Library/Java/Extensions, /Network/Library/Java/Extensions, /System/Library/Java/Extensions, /usr/lib/java, .]
    at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2660)
    at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:827)
    at java.base/java.lang.System.loadLibrary(System.java:1902)
    at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:1302)
    at org.bytedeco.javacpp.Loader.load(Loader.java:1021)
    ... 8 more

My pom.xml file is

<?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>

    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

    <groupId>org.example</groupId>
    <artifactId>untitled3</artifactId>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
        <dependency>
            <groupId>org.bytedeco.javacpp-presets</groupId>
            <artifactId>ffmpeg</artifactId>
            <version>4.1-1.4.4</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
        </dependency>
    </dependencies>

</project>
duplicate question

All 3 comments

You'll need to add a dependency on ffmpeg-platform, not just ffmpeg:
https://github.com/bytedeco/javacpp-presets/tree/master/ffmpeg/#sample-usage

Appearently, @saudet was right.

I have tried his suggestion way before openning this issue but I thought I did something wrong after seeing the stacktrace with same exception except its reason being

not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed

So upon focusing once again on the solution for this problem and desperately trying to manually-sign the library and failing, I have tried changing SDK.

And after changing my Java SDK to openjdk-14, problem was finally resolved.

Oh, that's good to know. Thanks for letting us know!
Could you give this a try @gtskaushik?
Maybe we can close https://github.com/bytedeco/javacv/issues/1275.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thunterdb picture thunterdb  路  37Comments

Maurice-Betzel picture Maurice-Betzel  路  32Comments

kwatters picture kwatters  路  24Comments

blueberry picture blueberry  路  32Comments

oneengineer picture oneengineer  路  34Comments