HOW TO

Hide console output for a MapObjects - Java application/applet

Last Published: April 25, 2020

Summary

By default, when a MapObjects - Java application or applet initializes and interacts with data, informational messages are returned in the Java console associated with the executing application. For example, when an ArcIMS layer is added to a Map bean, the ArcXML request for feature data or a map image is returned in the Java console window. Depending on the type and volume of interaction, the size of the message content may be substantial and may contain compromising information. As a result, developers may choose to eliminate or more closely control the message output to limit console usage and information dispersal.

Procedure

The following example provides a technique to eliminate message console output. Essentially, it adds an anonymous class to a functional MapObjects - Java application or applet. Use the following steps to implement this technique with your application:

  1. Open the class file that contains the main method for the application or init method for the applet. Add the following code snippet to the main or init method before the Map bean is instantiated:

    Code:
    System.setOut(new java.io.PrintStream(new java.io.OutputStream() {
    public void write(int b) throws java.io.IOException {
    }
    }));


    Note:
    This new java.io.OutputStream class overrides the write method for the output stream of character data to the console window. The write method is empty, thus the content of the output stream is not written to the console.

  2. Compile your main Application class, then execute your application. Note that messages are no longer visible in the console window.

Article ID:000005513

Software:
  • Legacy Products

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic