3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-06 09:34:08 +00:00
z3/examples/java
Karlheinz Friedberger 764e033bf4
Specify and document value for environment variable for loading native library in Java bindings (#5477)
* limit range of environment variable for loading the native library in Java to "true".

This change specifies the range of values that are allowed to set the environment
variable "z3.skipLibraryLoad".
Only the value "true" (in upper-, lower-, and mixed-case is accepted as valid value.
Other values, such as "false", "0", "1", "foo", an empty or a missing value are
evaluated to "false" and cause the default loading of the native library.

* adding documentation about environment variable for (not) loading the native library in Java.

This is a follow-up commit for #4667 to provide a publicly visible documentation.
2021-08-13 14:54:02 -07:00
..
JavaExample.java Java type generics (#4832) 2020-11-30 10:04:54 -08:00
JavaGenericExample.java Mixing Integers and Rational in the new Java API #5085 (#5098) 2021-03-16 05:24:23 -07:00
README Specify and document value for environment variable for loading native library in Java bindings (#5477) 2021-08-13 14:54:02 -07:00

A small example using the Z3 Java bindings.   

To build the example, configure Z3 with the --java option to scripts/mk_make.py, build via  
   make examples
in the build directory.

It will create JavaExample.class in the build directory,
which can be run on Windows via 
   java -cp com.microsoft.z3.jar;. JavaExample

On Linux and FreeBSD, we must use
   LD_LIBRARY_PATH=. java -cp com.microsoft.z3.jar:. JavaExample
On macOS, the corresponding option is DYLD_LIBRARY_PATH:
   DYLD_LIBRARY_PATH=. java -cp com.microsoft.z3.jar:. JavaExample  

By default, Z3 Java bindings are automatically loading the required native library for Z3 from the default library path.
In certain environments, depending on the developing process, the Z3 library is not available in the given library path.
To disable the automated loading process, the user can set the environment variable "z3.skipLibraryLoad=true".
In that case, the calling application should directly load the corresponding libraries before any interaction with Z3.