Consultor Eletrônico



Kbase 21378: How To Call a Java Program from the 4GL
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   9/4/2009
Status: Verified

GOAL:

How To Call a Java Program from the 4GL

FACT(s) (Environment):

All Supported Operating Systems
Progress 9.x
OpenEdge 10.x

FIX:

On Windows NT and on UNIX, a named pipe can be used to call the Java program and to display any data that it returns.

The following code can be run after launching the Procedure Editor from the command line. The Java environment variables must be set with the .class file being called in the CLASSPATH:

DEFINE VARIABLE w-Result AS CHARACTER NO-UNDO.
INPUT THROUGH (java HelloWorld).
REPEAT:
IMPORT UNFORMATTED w-Result.
MESSAGE w-Result VIEW-AS ALERT-BOX.
END.

If the Procedure Editor is launched from an icon, specify the classpath using the -cp parameter:

DEFINE VARIABLE w-Result AS CHARACTER NO-UNDO.
DEFINE VARIABLE w-ClassPath AS CHARACTER INITIAL "%CLASSPATH%"
NO-UNDO.

INPUT THROUGH (jview HelloWorld -cp w-ClassPath).
REPEAT:
IMPORT UNFORMATTED w-Result.
MESSAGE w-Result VIEW-AS ALERT-BOX.
END.