dayv2005
dayv2005

Reputation: 364

Make a Java Call from within Progress 4gl

Currently, I have a batch file that is basically running an executable jar.

Like this...

java -jar foo.jar

I have code in progress that is executing that batch file and piping out the values it returns into a txt document. I am then reading in that text document and parsing the info accordingly.

However, this is an ugly way of handling this and could lead to many issues down the road. I am basically just looking for a way in progress to execute a os-command and retrieve it's results without writing it to a file and reading back in.

I am running OpenEdge 10.1C

    DEFINE INPUT  PARAMETER iJarInput  AS CHARACTER NO-UNDO.
    DEFINE OUTPUT PARAMETER oJarOutput AS CHARACTER NO-UNDO.

    DEFINE VARIABLE cOut AS CHARACTER   NO-UNDO.
    DEFINE VARIABLE cCmd AS CHARACTER   NO-UNDO.

    ASSIGN
        cCmd = batchFile + " " + iJarInput.

    OS-COMMAND SILENT VALUE(cCmd).

    INPUT FROM VALUE(outFile).
    REPEAT:
        IMPORT UNFORMATTED cOut.
        oJarOutput = oJarOutput + cOut.
    END.

Upvotes: 0

Views: 1985

Answers (1)

Tom Bascom
Tom Bascom

Reputation: 14020

You can call external shared libraries.

http://documentation.progress.com/output/OpenEdge112/oe112html/ABL/wwhelp/wwhimpl/common/html/wwhelp.htm#href=Programming%20Interfaces/15dvpinch08epi.089.5.html&single=true

You could, for instance, use that capability to create a "shim" to your JAR.

Upvotes: 1

Related Questions