Fwd: O$: Studio 4.2, Mac OSX and Java Solved!

Paul Mulroney pmulroney at logicaldevelopments.com.au
Fri May 9 08:13:38 EDT 2008


Hi Everyone,

> Date: 1 May 2008 8:34:44 PM
>
> I'm trying to get Studio to work with a third-party java  
> application, and I'm having some grief in making it all happen.  I  
> was wondering if anyone has had any successful experiences using  
> Studio 4.2, Mac OSX and Java?
>
> I was getting frustrated with the third-party app, so I thought I'd  
> start again from the basics and create a simple Java class to talk  
> to Studio.  I compiled the app, and created a local variable of  
> type Object Reference, and the java method call $mirroroutput 
> ('test') returned a "method doesn't exist" error.

With the help of Vik at DLA, I've figured out my problem with this  
simple example.  Something Vik said during the DLA Roadshow (hint  
hint) got me thinking.

My Java routine took a String as a parameter, and returned a String.   
A String in Java <> Char in Omnis.  Omnis does method overloading,  
and was looking for a Java method that took char [] as a parameter  
and couldn't find it.

I modified my Omnis code to the following:

Calculate voMyObject as $extobjects.JavaObjs Library.$objects.// 
JavaObjs\ClassPath\pwm\pwm//.$newref()
Calculate voString as $extobjects.JavaObjs Library.$objects.//JavaObjs 
\System\java\lang\String//.$newref()
Do voMyObject.$createobject()
Do voMyObject.$initialise()     ;; No parameters, no result.  Should  
be writing to system output (somewhere)
Do voMyObject.$getversionid() Returns vsResult     ;; Returns String
Do voString.$createobject('This is a test')
Do voMyObject.$mirroroutput(voString) Returns vsResult     ;; Receive  
String, returns same result

-> I created a Java String object, and passed that in as a parameter,  
and it worked!

Bottom line: be very careful when writing Java in Omnis, you need to  
carefully check the data types being passed in to the methods.

Regards,
Paul.


If winners never quit, and quitters never win, then what idiot came  
up with "quit while you're ahead"?
-- 
Paul W. Mulroney                                                     
Logical Developments
pmulroney at logicaldevelopments.com.au         86 Coolgardie Street
www.logicaldevelopments.com.au                      BENTLEY  WA  6102
Ph: +61 8 9458 3889                                              Fax:  
+61 8 9458 2169






More information about the omnisdev-en mailing list