Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6768179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:02:41+00:00 2026-05-26T15:02:41+00:00

Microsoft.Z3.dll is described in the file properties as the Z3 Managed DLL. Java can

  • 0

Microsoft.Z3.dll is described in the file properties as the Z3 Managed DLL.

Java can load dlls. It does so using System.loadLibrary, or System.load, depending on the programmers preference.

If the Java designer also creates the DLL, javah can be used to define the import/export declarations. Unfortunately, that’s not my case. The DLL is already created by Microsoft as a Managed C# DLL.

I need some help taking a C# declaration such as the one found at Microsoft RISE Z3 managed API and prototyping a Java package/class to enable the call to succeed. (I am confident that the DLL is loaded).

To make it easier, the specific call is defined by Microsoft at line 03042 of Microsoft.Z3.h. Any sample code would be greatly appreciated!

The error I am getting from my server is:

java.lang.UnsatisfiedLinkError: Microsoft.Z3.GetVersion(
    LMicrosoft/Z3$IntPtr;
    LMicrosoft/Z3$IntPtr;
    LMicrosoft/Z3$IntPtr;
    LMicrosoft/Z3$IntPtr;)V
at Microsoft.Z3.GetVersion(Native Method)
at Microsoft.Z3.z3VersionString(Z3.java:81)
at DatabaseXml.XmlTest(DatabaseXml.java:66)
at DatabaseXml.doGet(DatabaseXml.java:124)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T15:02:41+00:00Added an answer on May 26, 2026 at 3:02 pm

    I had hoped that the managed version of the DLL would have some native compatibility with Java. It doesn’t appear so. So, the answer is to generate a new DLL that implements a JNI-compatible calling protocol as described in Sheng Liang’s “The Java™ Native Interface:Programmer’s Guide and Specification”. Some useful tutorials were found on David Caldwell’s website: InOnIt

    Most of the C source code was extracted from Scala^Z3 and the final version is:

    #include "stdafx.h"
    #include <jni.h>
    #include "z3.h"
    // #include "z3_api.h" (z3.h automatically includes z3_api.h)
    #include "HelloWorld.h"
    
    #ifdef __cplusplus
    extern "C" {
    #endif
        JNIEXPORT void JNICALL Java_example_jni_HelloWorld_getVersion (
            JNIEnv * env, 
            jclass cls, 
            jobject major, 
            jobject minor, 
            jobject buildNumber, 
            jobject revisionNumber
        ) {
    
            unsigned int cmaj, cmin, bn, rv;
            jclass ipc;
            jfieldID fid;
    
            Z3_get_version(&cmaj, &cmin, &bn, &rv);
    
            ipc = (env)->GetObjectClass(major);
            fid = (env)->GetFieldID(ipc, "value", "I");
            (env)->SetIntField(major, fid, (jint)cmaj);
            ipc = (env)->GetObjectClass(minor);
            fid = (env)->GetFieldID(ipc, "value", "I");
            (env)->SetIntField(minor, fid, (jint)cmin);
            ipc = (env)->GetObjectClass(buildNumber);
            fid = (env)->GetFieldID(ipc, "value", "I");
            (env)->SetIntField(buildNumber, fid, (jint)bn);
            ipc = (env)->GetObjectClass(revisionNumber);
            fid = (env)->GetFieldID(ipc, "value", "I");
            (env)->SetIntField(revisionNumber, fid, (jint)rv);
        }
    #ifdef __cplusplus
    }
    #endif
    

    The header files come from multiple sources: jni.h and its dependencies come with the JDK and reside in its include and include\win32 directories. z3.h and z3_api come from Microsoft RISE Z3 and are installed to C:\Program Files (x86)\Microsoft Research\Z3-3.2\include. Microsoft RISE also provides z3.lib which resides in C:\Program Files (x86)\Microsoft Research\Z3-3.2\bin; you will need to link this with the above code into a Win32 DLL project called Z3GetVersion_Release.dll.

    HelloWorld.h is generated by javah (see InOnIt for the example). To generate HelloWorld.h, you need the following Java class in a file named HelloWorld.java.

    package example.jni;
    
    public class HelloWorld {
    
        private static final String LIB_SEPARATOR = "\\";
        private static final String LIB_NAME = "Z3GetVersion_Release";
        private static final String LIB_EXT = ".dll";
    
        /** Placeholder class to ease JNI interaction. */
        public static class IntPtr {
            public int value;
        }
    
        // this is just to force class loading, and therefore library loading.
        public static void init() { }
    
        static {
            String curDir = System.getProperty("user.dir");
            try {
                System.load(curDir + LIB_SEPARATOR + LIB_NAME + LIB_EXT);
            } catch (UnsatisfiedLinkError e) {
                System.out.println("Library could not be found in directory:" + curDir );
            } catch (SecurityException e) {
                System.out.println("Security permissions prevented loading library from directory:" + curDir );
            }
        }
    
    
        /*private static void getVersion(IntPtr major, IntPtr minor, IntPtr buildNumber, IntPtr revisionNumber)
        {
            major.value=0;
            minor.value=0;
            buildNumber.value=0;
            revisionNumber.value=0;
        }*/   
        private static native void getVersion(IntPtr major, IntPtr minor, IntPtr buildNumber, IntPtr revisionNumber);
    
        public static String z3VersionString() {
            IntPtr major = new IntPtr();
            IntPtr minor = new IntPtr();
            IntPtr buildNumber = new IntPtr();
            IntPtr revisionNumber = new IntPtr();
            getVersion(major, minor, buildNumber, revisionNumber);
            return "Z3 " + major.value + "." + minor.value + " (build " + buildNumber.value + ", rev. " + revisionNumber.value + ")";
        }
    
        public static void main(String[] args) {
            System.out.println(z3VersionString());
        }
    }
    

    The sample code assumes you have copied all dlls from C:\Program Files (x86)\Microsoft Research\Z3-3.2\bin to your working directory, and you have pointed java.exe to the correct classpath where your compiled java classes are located. If all goes well, running the command “java example.jni.HelloWorld” will output the response: Z3 3.2 (build 0, rev. 0)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've compiled the RibbonLib, then I got two DLLs( Microsoft.WindowsAPICodePack.dll and Ribbon.dll ), but
When trying to load Microsoft.Xna.Framework.dll from any project, it throws a FileNotFoundException. The specified
I have installed the Windows Identity Foundation but can't find the Microsoft.IdentityModel dll. According
We were previously using an unsupported dll ( Microsoft.Crm.Application.Components.Core ) to check if the
I am using mshtml for html parsing. (version 7.0.3300.0, C:\Program Files\Microsoft.NET\Primary Interop Assemblies\Microsoft.mshtml.dll). HTMLDocumentClass
I am trying to play and audio file using DirectX dll. Audio.FromFile(Message 1.mp3).Play(); But
Does Microsoft.Sharepoint.dll come in both 32bit and 64bit flavors? So if I develop on
I was working in the Microsoft.Ink dll recently using C# and was debugging a
My target DLL file is Microsoft DirectInput dll file which is located here: C:\Windows\System32\Dinput.dll
We have an application that works with MS Office and uses Microsoft.mshtml.dll. We use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.