Example: Viewing a System.out message

The ActiveX to EJB bridge does not have a console available to view Java System.out messages. To view these messages when running a stand-alone client program (such as Visual Basic), we need to redirect the output to a file. For example

launchClientXJB.bat MyProgram.exe > output.txt

  • To view the System.out messages when running a Service program such as Active Server Pages, we need to override the Java System.out OutputStream object to FileOutputStream. For example, in VBScript

    'Redirect system.out to a file
    ' Assume that oXJB is an initialized XJB.JClassFactory object
     Dim clsSystem
     Dim oOS
     Dim oPS
     Dim oArgs
    
    ' Get the System class
      Set clsSystem = oXJB.FindClass("java.lang.System")
    
    ' Create a FileOutputStream object
    ' Create a PrintStream object and assign to it our FileOutputStream
      Set oArgs = oXJB.GetArgsContainer  oArgs.AddObject "java.io.OutputStream", oOS
      Set oPS = oXJB.NewInstance(oXJB.FindClass("java.io.PrintStream"), oArgs)
    
    ' Set our System OutputStream to our file
      clsSystem.setOut oPS
    


 

Related Tasks


Developing ActiveX application client code