6.9 Customizing Java Run Time System

As AHF Scope is written in Java, it is platform independent.

The script ahfscope invokes the Java Virtual Machine (JVM) with Oracle classes. Knowledgeable users may consider customizing this script, or use the environment variable _JAVA_OPTIONS to determine the way the JVM executes code.

JVM is the run-time process, which interprets Java classes. All contemporary JVM's incorporate some method of on-the-fly translation of bytecode into native code. Dominating in this field is the Hot Spot. Except for beginning invocations of classes, in most cases Java methods run later in native code. Consequently, they perform at speeds comparable to programs written in native languages, such as C.

Furthermore, on many platforms Java supports native 2D and 3D graphics with a hardware acceleration through the use of the Open GL libraries that significantly improves display performance. It is highly recommended that Open GL will be configured for default use with JVM. Information about the Open GL library is available at: http://www.opengl.org/. Most manufacturers of rendering hardware, that is graphics cards, provide a version of this library for their video cards. It is important to obtain a current version of this library, besides the current drivers for the graphics card. See the following sites for detailed information about Java rendering using Open GL:
  • https://docs.oracle.com/javase/8/docs/technotes/guides/2d/flags.html#opengl
  • https://docs.oracle.com/javase/8/docs/technotes/guides/2d/new_features.html
JVM activation flags for OpenGL are:
  • -Dsun.java2d.opengl=true: Use the OpenGL pipeline
  • -Dsun.java2d.d3d=true: Use the Direct3D accelerator for Microsoft Windows

AHF Scope does not render in 3D, but benefits greatly from the accelerated region repaint available through Direct3D.

JVM options may be used with the java command, or declared as an environment variable, _JAVA_OPTIONS.

Linux Example:
_JAVA_OPTIONS="-Dsun.java2d.opengl=True -Dsun.java2d.d3d=true"  export _JAVA_OPTIONS
Note the capitol "T" in the "true": If written with a capital letter, Java will print to the standard output whether the OpenGL pipeline is available or not. The following is an example of a warning that Open GL is not available:
Picked up _JAVA_OPTIONS: -Dsun.java2d.opengl=True -Dsun.java2d.d3d=true
Could not enable OpenGL pipeline for default config on screen 0
In this case, the system does not have a graphics card supporting OpenGL. The following is an example of a system with a graphics card supporting OpenGL:
OpenGL pipeline enabled for default config on screen 0

In the case of some graphics cards, OpenGL requires the option: sun.java2d.opengl.fbobject=false. See section 3.1.5.5 Diagnosing Rendering and Performance Issues in the following document: http://www.oracle.com/technetwork/java/javase/index-142560.html.

This link is the current and comprehensive description of potential issues with OpenGL and Java 2D drawing package in conjunction with specific hardware/driver versions.