问:[Z3] java.lang.NoClassDefFoundError:无法初始化类com.microsoft.z3.Native

问题描述 投票:0回答:1

当我像这样使用maven依赖时

<dependency>
      <groupId>org.sosy-lab</groupId>
      <artifactId>javasmt-solver-z3</artifactId>
      <version>z3-4.4.1-1558-gf96cfea</version>
</dependency>

然后我用java的例子

public void simpleExample()
{

    System.out.println("SimpleExample");
    try {
        Log.open("SimpleExample");
        Log.append("SimpleExample");
    }catch (Exception e){
        e.printStackTrace();
    }finally{
        Log.close();
    }

    {
        Context ctx = new Context();
        /* do something with the context */

        /* be kind to dispose manually and not wait for the GC. */
        ctx.close();
    }
}

一旦我使用Native.java,只显示这个问题,出了什么问题?

maven z3
1个回答
0
投票

要使用Java API,您应该在IDE中设置环境变量,如下所示:

LD_LIBRARY_PATH = path_to_build_folder_of_z3_source

只需按照this页面中的说明构建源代码即可。

© www.soinside.com 2019 - 2024. All rights reserved.