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.
Arne Vajhøj - 03 Mar 2008 22:00 GMT
> 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
[quoted text clipped - 8 lines]
> 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
Alex.From.Ohio.Java@gmail.com - 03 Mar 2008 23:10 GMT
> > 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
[quoted text clipped - 16 lines]
>
> Arne
Why not simply communicate with already running JVM.
VBA <-> Java.
It could be done by TCP/webservices/JNI/whatever.
http://www.myjavaserver.com/~alexfromohio/
Arne Vajhøj - 04 Mar 2008 02:19 GMT
>>> 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
[quoted text clipped - 16 lines]
> 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
Roedy Green - 03 Mar 2008 23:16 GMT
On Mon, 3 Mar 2008 07:16:52 -0800 (PST), fsumathguy
<aculham@hotmail.com> wrote, quoted or indirectly quoted someone who
said :
>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
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Arne Vajhøj - 04 Mar 2008 02:18 GMT
> 1. talk via an SQL database.
>
[quoted text clipped - 8 lines]
> 5. JNI where C++ spawns a JVM and calls Java methods.
> see http://mindprod.com/jgloss/jni.html
You do not need to spawn to call Java from C++.
Arne
Roedy Green - 04 Mar 2008 07:18 GMT
>You do not need to spawn to call Java from C++.
Not an exec call, but JNI does launch a JVM.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Arne Vajhøj - 05 Mar 2008 01:25 GMT
>> You do not need to spawn to call Java from C++.
>
> Not an exec call, but JNI does launch a JVM.
Yes. But it does not spawn.
http://en.wikipedia.org/wiki/Spawn_%28computing%29
Arne
Hugo - 06 Mar 2008 06:48 GMT
> 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
[quoted text clipped - 14 lines]
>
> 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.