Java Client¶
VisIt’s Java API allows Java applications to control VisIt’s viewer. Java applications can launch VisIt’s viewer window and control it programmatically, even replacing VisIt’s GUI with a custom Java GUI.
Disclaimers:
The Java client for a particular version of VisIt is available as separate tarball on our downloads page.
Look for jvisit<version>.tar.gz
, e.g. jvisit3.3.0.tar.gz
.
Simply untar to the directory of your choosing to use it.
Building from source¶
To build the java client from a source build of VisIt, you must set the VISIT_JAVA
CMake bool variable to true
when configuring VisIt with CMake.
Once the CMake configure step is complete, cd to the java subdirectory of the build directory and type make
.
This will compile the core parts of the Java interface.
There are two other targets that can be built from the java directory: main
and pack
.
The main
target will build the class files for all the examples.
The pack
target causes a JAR file to be created and then packaged up with the Java source code, docs and example programs into a TAR file that can be shared.
The created visit.jar
file will be present in the build directory.
The pack
target will also build the example class files if not already built.
Examples¶
What follows are examples of how VisIt’s Java client can be used.
Source code for each example is available in the java
subdirectory of the source code repository.
There are several arguments that are common to all the examples:
- -stay:
- tells the program to continue running after the work() method has completed instead of exiting.
- -path:
- path to VisIt’s bin directory, eg,
/usr/local/visit/3.3.0/bin
- -datapath:
- path to VisIt’s silo example data (used by many of the examples)
eg:
/usr/local/visit/3.3.0/data
- -dv:
- Tells the example application that it will be connecting to a development version of VisIt. This is important because an installed version of VisIt is structured slightly differently than a build.
All of the examples are available from the src/java
directory.
- Basic example
- Controlling lighting
- Performing queries
- Getting metadata
- Controlling annotations
- Making host profiles
- Opening the visIt GUI from Java
- Determining which variables can be plotted
- Executing Python from Java
- Plotting vectors from Java
- Changing plot attributes
- Changing points size and shape
- Using Threshold operator
Acknowledgements¶
This document is primarily based on visitusers.org wiki pages written by Brad Whitlock. The Java client itself and most of the examples were also initially created by Brad in 2002.