Skip to content
Paul Dubs edited this page Aug 4, 2021 · 3 revisions

JavaCPP allows you to modify some of its behavior at runtime with system properties.

You set the system properties when starting your application with the command line parameter -Dpropertyname=value.

The following system properties are defined:

System Property Possible Values Description
org.bytedeco.javacpp.logger slf4j, something else If the “org.bytedeco.javacpp.logger” system property is set to “slf4j”, returns new Slf4jLogger(Class), else returns new Logger().
org.bytedeco.javacpp.logger.debug true, false Enables debug logging
org.bytedeco.javacpp.noPointerGC true, false Disables automatic garbage collection for pointers
org.bytedeco.javacpp.maxBytes a number Maximum amount of memory registered with live deallocators before forcing call to System.gc(). Defaults to Runtime.maxMemory(). The value is parsed with parseBytes(String, long) where relativeMultiple = Runtime.maxMemory(). We can use a value of 0 or less to prevent any explicit call to the garbage collector.
org.bytedeco.javacpp.maxPhysicalBytes a number Maximum amount of memory reported by physicalBytes() before forcing call to System.gc(). Defaults to maxBytes > 0 ? maxBytes + Runtime.maxMemory() : 0. If maxBytes is also not set, this is equivalent to a default of 2 * Runtime.maxMemory(). The value is parsed with parseBytes(String, long) where relativeMultiple = Runtime.maxMemory(). We can use a value of 0 or less to prevent any explicit call to the garbage collector.
org.bytedeco.javacpp.maxRetries a number Maximum number of times to call System.gc() before giving up with OutOfMemoryError. Defaults to 10, where each retry is followed by a call to Thread.sleep(100) and Pointer.trimMemory().
org.bytedeco.javacpp.loadlibraries true, false
org.bytedeco.javacpp.cachedir filesystem path Defaults to “~/.javacpp/cache”. Specifies the folder where javacpp will unpack and cache native libraries
org.bytedeco.javacpp.cachedir.nosubdir true, t Do not use a sub-directory named after the jar file when caching the unpacked library files

For more details take also a look at the JavaDoc too: