Invoking Java from Tcl??

Clovertech Forums Cloverleaf Invoking Java from Tcl??

  • Creator
    Topic
  • #120341
    Jim Kosloskey
    Participant

      Has anybody invoked Java modules from inside a TPS Type proc?

      Based on some really primitive search of the internet, this seems like it could be possible to do.

      I am thinking of invoking Java to do some GUI type work from within a TPS Type proc.

      An argument set would need to be provided to the Java Code and the Java Code would need to return an argument set.

      I know very little about Java but at this point I just want to know if this is even worth considering.

       

      email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

    Viewing 2 reply threads
    • Author
      Replies
      • #120342
        Jeff Dinsmore
        Participant

          How about Tcl’s graphic toolkit Tk?

          I’m curious to know what kind of GUI app you’re planning to call from within a TPS proc.

          Jeff Dinsmore
          Chesapeake Regional Healthcare

        • #120343
          Jim Kosloskey
          Participant

            Well as I consider the challenge more closely, I realize the TPS proc would not be the appropriate place.

            The appropriate place would be in the NetConfig when gathering arguments for a TPS proc. But there is no point I know of at which to grab control.

            At one time, when the GUI was TK based, there was a plan to allow an IE to specify code to be executed within the NetConfig where the arguments for a TPS proc is specified. That code would then return the arguments to be used by the TPS proc. I think that plan was abandoned when the engine GUI was written in Java.

            So please ignore this post – it is not really relevant to what I was investigating.

            Just not thinking clearly today.

            email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

          • #120344
            Dirk Engels
            Participant

              Jim,

              doing this in a tcl proc is a bad idea, because you would block your whole process. That’s why the javadriver proc was developed. The reason is how Cloverleaf actually call a java class. As the engine cannot call the java class directly, the engine calls the tcl interpreter which will call a tps proc. This tps proc calls a java runtime and that will run the java class. If you configure a java class in the gui, you can see, that there will a a tcl proc called. Look at $HCIROOT/tclprocs/tclIndex. You see some entries starting with clj… referring to $HCIROOT/tcl/lib/tfc/cloverleafJava.tcl. That’s how the engine executes a java class.

              As long as your java proc is running, the thread and therefore the whole process is blocked.

              But if you like to do it anyway, put that thread in a separate process. I would suggest to use two procs. First call the java class and do whatever you want. The proc should give a message back which you then may process in a tcl proc afterwards. You can mix up tcl and java in a tps.

          Viewing 2 reply threads
          • You must be logged in to reply to this topic.