开发者

Calling a Java program from Microsoft Access

I have two programs I need to integrate. One is a Microsoft Access program. The other is a Java progra开发者_运维问答m. No flexibility on choice of platform for either one here, these are existing complex programs.

The Access program needs at some point to spit out one line of text which the Java program knows how to convert into a code (another line of text), and receive that code back. The Java program is simply a command line app, packaged as a jar, that takes in the one bit of text and spits out the other.

What is the simplest way to do this?

I take it Access can't do system calls directly because of security concerns, unless I'm missing something? Previously the conversion utility was packaged as a DLL and called through OLE. I can package the jar file as a DLL, but that seems roundabout. Is that the best I can do?

(If there is another similar question, just point me at it. In search results for Java and Access people tend usually to be doing the opposite: accessing an Access database through Java).


How about using the technique described on this page.

You'd change the string that's given to the WScript.Shell.Exec() function to whatever command you need to execute your Java program. Then the Java program's output would be available via calling ReadAll() the Exec object's StdOut property.


Why not simply spawn the Access process off as a subprocess of a Java program containing your existing .jar ? That way you don't have to perform any Java/MS-specific integration and you can make use of the existing .jar as a library in your new Java program.

Capture the stdout of the Access program, process it in Java and then write it back in via the stdin ? See the Process object for more info, and this answer for more info on how to consume stdout/err and links to an example.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜