Java example: MakeHostProfile

This program shows how to host to create a host profile, add it to the host profile list, and send it to the viewer. The program then goes on to access data on the remote computer, making use of the host profile that was created. Additional options such as how to launch the engine in parallel could be added to the host profile. Also, more profiles could be added to the host profile list before sending it to the viewer.

Running the program

java -cp . MakeHostProfiles -dv

If the above command line does not work or if the viewer seems to stall when connecting to the remote computer, try adding the -nopty argument to make VisIt prompt for passwords in the console in which you ran Java. This should rarely be necessary.

Program source code

import llnl.visit.ViewerProxy;
import llnl.visit.MachineProfile;
import llnl.visit.LaunchProfile;
import llnl.visit.HostProfileList;

// ****************************************************************************
// Class: MakeHostProfile
// Purpose:
//   This class implements an example program that shows how to use the 
//   ViewerProxy class and control VisIt's viewer from Java.
// Notes:      
// Programmer: Brad Whitlock
// Creation:   Mon Aug 10 13:40:40 PDT 2009
// Modifications:
//   Jeremy Meredith, Thu Feb 18 17:14:38 EST 2010
//   Split host profile into machine profile and launch profile.
//   Also, added directory argument.
// ****************************************************************************

public class MakeHostProfile extends RunViewer
    public MakeHostProfile()

    protected void work(String[] args)

        // Change these for your remote system.
        String host = "remotehost";
        String user = "remoteusername";
        String remotevisitPath = "/path/to/visit";

        // Basic, serial profile.
        LaunchProfile example = new LaunchProfile();
        // Create a new machine profile object and the serial launch profile.
        MachineProfile profile = new MachineProfile();

        // Replace the list of host profiles and tell the viewer about the changes. We could
        // have added to the list instead of clearing the list.
        System.out.println("HostProfileList = \n" + 

        // Do a plot of the remote data.
        String remoteData = host + ":" + remotevisitPath + "/data/globe.silo";
            viewer.GetViewerMethods().AddPlot("Pseudocolor", "u");
            viewer.GetViewerMethods().AddPlot("Mesh", "mesh1");
            System.out.println("Could not open the database!");

    public static void main(String args[])
        MakeHostProfile r = new MakeHostProfile();;

Platform comments

It's been said that this example does not work on the Windows platform when the remote server is a Linux cluster. The reported problem was a hang when trying to connect to a remote Linux cluster when running the Java client on the local Windows computer. So far, I have not been able to reproduce that problem.

I ran with:

  1. Client: VisIt 2.2.2 64-bit on a Windows 7 64-bit Ultimate computer
  2. The above sources with host, user, and remotevisitPath set to the right values for my account on the remote computer.
  3. Server: VisIt 2.2.2 running on (Linux 2.6.18-238.9.1.el5.bsdv3 #1 SMP Tue Apr 26 13:54:10 PDT 2011 x86_64 x86_64 x86_64 GNU/Linux)
  4. Java compiler: javac 1.6.0_17

I opened up a Windows command prompt window and issued:

java -cp .;visit.jar MakeHostProfile -stay

VisIt started up and prompted me for my password on using VisIt's standard qtssh.exe program. After the engine started, the Java program was able to plot the globe dataset.