Calling Java from other programs

F

fsumathguy

Hello. I am sure this has been asked numerous times before, but I am
unable to find a conclusive answer. Please forgive me if this info is
available elsewhere.

I am developing a model to be used by others within my company.
Because the end users are sort of a mixed bag with respect to
technical backgrounds, we generally present everything in MS Excel.
While Excel comes with VBA, I find this language cumbersome and
annoying to develop anything larger than a few lines. My program of
choice is Java. My question is, how can I do my development in Java,
then compile the results into an executable that I could subsequently
call from VBA? My boss (who is somewhat old school with repect to
programming) does a similar thing using Fortran 90. He is able to
generate a DLL file which allows him to pass all of the needed
parameters to his Fortran routine from VBA. Can I do something
similar with Java?

Thanks in advance for any help.
 
A

Arne Vajhøj

fsumathguy said:
I am developing a model to be used by others within my company.
Because the end users are sort of a mixed bag with respect to
technical backgrounds, we generally present everything in MS Excel.
While Excel comes with VBA, I find this language cumbersome and
annoying to develop anything larger than a few lines. My program of
choice is Java. My question is, how can I do my development in Java,
then compile the results into an executable that I could subsequently
call from VBA? My boss (who is somewhat old school with repect to
programming) does a similar thing using Fortran 90. He is able to
generate a DLL file which allows him to pass all of the needed
parameters to his Fortran routine from VBA. Can I do something
similar with Java?

In theory you can:

VBA---(Win32 DLL call)--->simple wrapper in C---(JNI call)--->Java

In most cases I think it would be too cumbersome.

Arne
 
R

Roedy Green

My program of
choice is Java. My question is, how can I do my development in Java,
then compile the results into an executable that I could subsequently
call from VBA?

there are several approaches depending on how tight you need the
coupling. Here are a few techniques.

1. talk via an SQL database.

2. communication via TCP/IP sockets. Each runs in its own address
space.

3. C++ exec java.exe

4. C++ exec Jet compiled java. See
http://mindprod.com/jgloss/jet.html/

5. JNI where C++ spawns a JVM and calls Java methods.
see http://mindprod.com/jgloss/jni.html

for even more, see http://mindprod.com/jgloss/remotefileaccess.html
 
A

Arne Vajhøj

Why not simply communicate with already running JVM.
VBA <-> Java.

Because that was not what was asked for.
It could be done by TCP/webservices/JNI/whatever.

Is it possible to connect to a running JVM via JNI ??

Arne
 
H

Hugo

Hello. I am sure this has been asked numerous times before, but I am
unable to find a conclusive answer. Please forgive me if this info is
available elsewhere.

I am developing a model to be used by others within my company.
Because the end users are sort of a mixed bag with respect to
technical backgrounds, we generally present everything in MS Excel.
While Excel comes with VBA, I find this language cumbersome and
annoying to develop anything larger than a few lines. My program of
choice is Java. My question is, how can I do my development in Java,
then compile the results into an executable that I could subsequently
call from VBA? My boss (who is somewhat old school with repect to
programming) does a similar thing using Fortran 90. He is able to
generate a DLL file which allows him to pass all of the needed
parameters to his Fortran routine from VBA. Can I do something
similar with Java?

Thanks in advance for any help.

Direct calls can be pretty cumbersome.

Can you use wire protocols such as XML-RPC or SOAP? This could be much
more convenient; the wire protrocol calls can be used to initiate a
request and the call handles within the VB or Java system.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top