Page 1 of 1

Can we call EViews programme through Java?

Posted: Mon Sep 23, 2019 6:11 am
by Alfred123
Dear all,

We all know EViews11 can call programmes such as MATLAB, R and Python.

But can we call EViews programme through other popular languages? Especially through Java?

If it could, how can we do it?

Thanks a lot!

Re: Can we call EViews programme through Java?

Posted: Mon Sep 23, 2019 7:57 am
by EViews Steve
When we say that EViews can connect to external environments such as R, MATLAB, and Python, we're specifically talking about the ability to do the following from within EViews:
  • 1. Open an external session. (XOPEN)
    2. Transfer EViews data to the external environment (XPUT)
    3. Run an external command (XRUN)
    4. Retrieve external data back into EViews (XGET)
    5. Close external session (XCLOSE)
R, MATLAB, & Python all allow you to run them "interactively" -- meaning you can start a REPL session to interactively run commands. This type of interactive session is a basic requirement for EViews to be able to connect and use it from EViews.

As far as I know, there isn't a way to run a REPL session with Java, as it is purely a programming language that needs to be pre-compiled to run.

I would suggest doing one of the following instead:

Launch a Java Program
From within EViews, you can run a pre-compiled Java program using our SPAWN command. In this situation, you'll have to use an external CSV or TXT file to transfer data between EViews and Java.

Launch and Control EViews from Java
From within Java, use and control EViews using our COM Automation interface. Look into using COM objects from Java and refer to our COM Automation whitepaper that explains how to programmatically control EViews. Once you have an EViews Application object in your Java program, you call the PutData and GetData methods to transfer data to and from Java, without having to mess with external files.

Steve

Re: Can we call EViews programme through Java?

Posted: Mon Sep 23, 2019 6:47 pm
by Alfred123
When we say that EViews can connect to external environments such as R, MATLAB, and Python, we're specifically talking about the ability to do the following from within EViews:
  • 1. Open an external session. (XOPEN)
    2. Transfer EViews data to the external environment (XPUT)
    3. Run an external command (XRUN)
    4. Retrieve external data back into EViews (XGET)
    5. Close external session (XCLOSE)
R, MATLAB, & Python all allow you to run them "interactively" -- meaning you can start a REPL session to interactively run commands. This type of interactive session is a basic requirement for EViews to be able to connect and use it from EViews.

As far as I know, there isn't a way to run a REPL session with Java, as it is purely a programming language that needs to be pre-compiled to run.

I would suggest doing one of the following instead:

Launch a Java Program
From within EViews, you can run a pre-compiled Java program using our SPAWN command. In this situation, you'll have to use an external CSV or TXT file to transfer data between EViews and Java.

Launch and Control EViews from Java
From within Java, use and control EViews using our COM Automation interface. Look into using COM objects from Java and refer to our COM Automation whitepaper that explains how to programmatically control EViews. Once you have an EViews Application object in your Java program, you call the PutData and GetData methods to transfer data to and from Java, without having to mess with external files.

Steve
Many thx Steve, I will have a try. And love EViews forever!