Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Using JAVA inside VBA

Reply
Thread Tools

Using JAVA inside VBA

 
 
Ghislain
Guest
Posts: n/a
 
      05-11-2013
Hello,
I have a compiled commercial jar that I want to use in VBA, something like :
Dim javaob As Object
Set javaob = CreateObject("MyJavaAPIObject")
result = javaob.doSomething()

Unforunately, I can't convert the API to a COM object. As far as I know, it was possible 10 years ago but it is no longer possible unless you use commercial products (like EZJCom).

Do you have any ideas ?
Thanks,
Ghislain
 
Reply With Quote
 
 
 
 
Arne Vajhøj
Guest
Posts: n/a
 
      05-11-2013
On 5/11/2013 12:31 PM, Ghislain wrote:
> I have a compiled commercial jar that I want to use in VBA, something like :
> Dim javaob As Object
> Set javaob = CreateObject("MyJavaAPIObject")
> result = javaob.doSomething()
>
> Unforunately, I can't convert the API to a COM object. As far as I know, it was possible 10 years ago but it is no longer possible unless you use commercial products (like EZJCom).
>
> Do you have any ideas ?


12-15 years ago wrapping Java beans as COM objects was hot.

Not any more.

But try and see if something like:

http://www.rgagnon.com/javadetails/java-0045.html

still works.

Arne


 
Reply With Quote
 
 
 
 
Ghislain
Guest
Posts: n/a
 
      05-11-2013
Le samedi 11 mai 2013 18:41:16 UTC+2, Arne Vajhøj a écrit*:
> On 5/11/2013 12:31 PM, Ghislain wrote:
>
> > I have a compiled commercial jar that I want to use in VBA, something like :

>
> > Dim javaob As Object

>
> > Set javaob = CreateObject("MyJavaAPIObject")

>
> > result = javaob.doSomething()

>
> >

>
> > Unforunately, I can't convert the API to a COM object. As far as I know, it was possible 10 years ago but it is no longer possible unless you use commercial products (like EZJCom).

>
> >

>
> > Do you have any ideas ?

>
>
>
> 12-15 years ago wrapping Java beans as COM objects was hot.
>
>
>
> Not any more.
>
>
>
> But try and see if something like:
>
>
>
> http://www.rgagnon.com/javadetails/java-0045.html
>
>
>
> still works.
>
>
>
> Arne


Thanks Arne but I had tried it already and the packager used is not workinganymore. I think the article was written by the time it worked (a long time ago)
Ghislain
 
Reply With Quote
 
Ghislain
Guest
Posts: n/a
 
      05-12-2013
Le dimanche 12 mai 2013 11:02:02 UTC+2, Chris Uppal a écrit*:
> Ghislain wrote:
>
> > Hello,

>
> > I have a compiled commercial jar that I want to use in VBA, something

>
>
>
> > Unforunately, I can't convert the API to a COM object. As far as I know,

>
> > it was possible 10 years ago but it is no longer possible unless you use

>
> > commercial products (like EZJCom).

>
> >

>
> > Do you have any ideas ?

>
>
>
> Buy the commercial product ?
>
>
>
> Wrap the JAR up in an executable that makes the API available over TCP/IP, and
>
> then create a COM object that uses that network interface ?
>
>
>
> If you are capable of developing simple COM objects in C++, then it mightbe
>
> simpler to use something like Jace:
>
> http://code.google.com/p/jace/wiki/Overview
>
> to create JNI-based wrapper code that your COM-server layer can talk to.
>
>
>
> Open Office / Libre Office used to be able to talk to Java, as I understand it.
>
> Maybe they still can, and it would be easier for you to use your existing
>
> commercial component with one of them.
>
>
>
> If you have the remarkably good sense, not to mention good fortune, to bea
>
> Smalltalk programmer, then you could use Dolphin Smalltalk (which can generate
>
> COM objects) + my very own (advt.) JNIPort to bridge between COM and Java....
>
>
>
> But buying the commercial product seems the best bet to me. After all, you've
>
> already paid for the two products you want to connect, why baulk at paying for
>
> the bridge too ?
>
>
>
> -- chris


Thank you Chris for these interestings ideas.
I already bought the awfully expensive software but it is only available injava.
I'll try jace but I understand it is not as simple as it used to be with the sun's packager.
Ghislain
 
Reply With Quote
 
Real Gagnon
Guest
Posts: n/a
 
      05-12-2013
Ghislain <(E-Mail Removed)> wrote in
news:(E-Mail Removed):

> Le samedi 11 mai 2013 18:41:16 UTC+2, Arne Vajhøj a écrit*:
>> But try and see if something like:
>> http://www.rgagnon.com/javadetails/java-0045.html
>> still works.

>
> Thanks Arne but I had tried it already and the packager used is not
> working anymore. I think the article was written by the time it worked
> (a long time ago) Ghislain


ActiveX bridge is still there in 1.7.

http://docs.oracle.com/javase/7/docs...xbridge/develo
perguide/index.html

Bye.
--
Real Gagnon from Quebec, Canada
* Java, Javascript, VBScript or PowerBuilder snippets
* http://rgagnon.com/howto.html
* http://rgagnon.com/bigindex.html
 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      05-13-2013
On 5/11/2013 2:45 PM, Ghislain wrote:
> Le samedi 11 mai 2013 18:41:16 UTC+2, Arne Vajhøj a écrit :
>> On 5/11/2013 12:31 PM, Ghislain wrote:
>>> I have a compiled commercial jar that I want to use in VBA, something like :
>>> Dim javaob As Object
>>> Set javaob = CreateObject("MyJavaAPIObject")
>>> result = javaob.doSomething()
>>>
>>> Unforunately, I can't convert the API to a COM object. As far as I know, it was possible 10 years ago but it is no longer possible unless you use commercial products (like EZJCom).
>>>
>>> Do you have any ideas ?

>>
>> 12-15 years ago wrapping Java beans as COM objects was hot.
>>
>> Not any more.
>>
>> But try and see if something like:
>>
>> http://www.rgagnon.com/javadetails/java-0045.html
>>
>> still works.

>
> I had tried it already and the packager used is not working anymore. I think the article was written by the time it worked (a long time ago)


Could you elaborate on "not working"?

COM has not changed.

Java version X has not changed.

Why did it work once and no longer?

Arne


 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      05-13-2013
On 5/12/2013 5:02 AM, Chris Uppal wrote:
> Ghislain wrote:
>> I have a compiled commercial jar that I want to use in VBA, something

>
>> Unforunately, I can't convert the API to a COM object. As far as I know,
>> it was possible 10 years ago but it is no longer possible unless you use
>> commercial products (like EZJCom).
>>
>> Do you have any ideas ?

>
> Buy the commercial product ?
>
> Wrap the JAR up in an executable that makes the API available over TCP/IP, and
> then create a COM object that uses that network interface ?
>
> If you are capable of developing simple COM objects in C++, then it might be
> simpler to use something like Jace:
> http://code.google.com/p/jace/wiki/Overview
> to create JNI-based wrapper code that your COM-server layer can talk to.
>
> Open Office / Libre Office used to be able to talk to Java, as I understand it.
> Maybe they still can, and it would be easier for you to use your existing
> commercial component with one of them.


OOo/LO use UNO and there is an UNO binding for Java.

And it would very difficult to remove as certain parts of OOo/LO are
written in Java.

> If you have the remarkably good sense, not to mention good fortune, to be a
> Smalltalk programmer, then you could use Dolphin Smalltalk (which can generate
> COM objects) + my very own (advt.) JNIPort to bridge between COM and Java...
>
> But buying the commercial product seems the best bet to me. After all, you've
> already paid for the two products you want to connect, why baulk at paying for
> the bridge too ?


You get lots of money by not spending them.



Arne


 
Reply With Quote
 
Ghislain
Guest
Posts: n/a
 
      05-13-2013
Le lundi 13 mai 2013 02:28:39 UTC+2, Arne Vajhøj a écrit*:
> On 5/11/2013 2:45 PM, Ghislain wrote:
>
> > Le samedi 11 mai 2013 18:41:16 UTC+2, Arne Vajhøj a écrit :

>
> >> On 5/11/2013 12:31 PM, Ghislain wrote:

>
> >>> I have a compiled commercial jar that I want to use in VBA, somethinglike :

>
> >>> Dim javaob As Object

>
> >>> Set javaob = CreateObject("MyJavaAPIObject")

>
> >>> result = javaob.doSomething()

>
> >>>

>
> >>> Unforunately, I can't convert the API to a COM object. As far as I know, it was possible 10 years ago but it is no longer possible unless you use commercial products (like EZJCom).

>
> >>>

>
> >>> Do you have any ideas ?

>
> >>

>
> >> 12-15 years ago wrapping Java beans as COM objects was hot.

>
> >>

>
> >> Not any more.

>
> >>

>
> >> But try and see if something like:

>
> >>

>
> >> http://www.rgagnon.com/javadetails/java-0045.html

>
> >>

>
> >> still works.

>
> >

>
> > I had tried it already and the packager used is not working anymore. I think the article was written by the time it worked (a long time ago)

>
>
>
> Could you elaborate on "not working"?
>
>
>
> COM has not changed.
>
>
>
> Java version X has not changed.
>
>
>
> Why did it work once and no longer?
>
>
>
> Arne


Hello Arne,
"not working" means that after this command :
"C:\Program Files (x86)\Java\jdk1.7.0_21\bin\packager" -clsid {c6d7e762-5c47-4385-882d-b4679a013bdf} -out "C:\Program Files (x86)\Java\jre7\axbridge\bin" "C:\Users\gbenrais\Documents\NetBeansProjects\Pers onBean\dist\PersonBean.jar" org.netbeans.examples.person.PersonBean

I get the following result :
Processing C:\Users\gbenrais\AppData\Local\Temp\\PersonBean.i dl
Processing C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\oaidl.idl
Processing C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\objidl.idl
Processing C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\unknwn.idl
Processing C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\wtypes.idl
Processing C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\basetsd.h
Processing C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\guiddef.h
Processing C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\oaidl.acf
midl\oleaut32.dll : error MIDL2020 : error generating type library : SetFuncAndParamNames failed : get_address (0x8002802C)
La génération de la bibliothèque type a échoué


I tried with different java apis and it failed at the very same step with the same error

Thanks for your help,
Ghislain
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
java to vba PST Java 2 05-10-2007 02:33 AM
using VBA Access code =?Utf-8?B?d2hvZHVuaXQ=?= ASP .Net 2 04-17-2005 04:55 PM
"operation is not allowed when the object is closed" error when using VBA online help -- Resolution TC ASP General 1 01-12-2005 09:05 AM
Java calling C# or VBA (MS Office API) ? Oleg Konovalov Java 6 06-04-2004 03:18 PM
Hashtable to VBA using SOAP Toolkit Salman ASP .Net Web Services 3 05-24-2004 07:04 AM



Advertisments