Mark,

There are no issues with calling Static methods.  You just
createObject("java", "class") and call the static methods on that directly.

The reason I asked what version of CF he is on, is because he will need to
pass a String[] into the main() argument scope.

If he is on CF8, he can use JavaCast, otherwise, he will have to build the
array using java.lang.reflext.Array

Mark

On Feb 9, 2008 1:06 AM, Gaulin, Mark <[EMAIL PROTECTED]> wrote:

> Hi
> You may be having issues because the "main" method appears to be a
> static method, and I seem to recall that there is an issue with calling
> those directly from CF when you don't have an instance of the class
> handy.
>
> I suggest you create a java class of your own that does the calls you
> want, but make your class something you can instantiate (so the methods
> are not static).  I bet you'll be able to use CreateObject to create an
> instance of your class and then you can call the method that does the
> work you want.
>
> Here's a quick sketch of this new class:
>
> package com.xyz;
> import (stuff from jar);
>
> public class FrameworkManagerStub {
>        public static final String componentFile = "config/client.xml";
>
>        public FrameworkManagerStub() {
>        }
>
>        public MessageFactory createMessageFactory() {
>                String[] compArgs = new String[] { componentFile };
> // same as new String[1], etc
>                FrameworkManager.main(compArgs);
>                MessageFactory mf = (MessageFactory)
> FrameworkManager.getComponent(MessageFactory.ROLE);
>                return mf;
>        }
> }
>
> I'm assuming that you want to create a MessageFactory for use in CF, but
> I could be wrong about that.
>
> Here is how it would be used:
> <cfset mf = CreateObject("java",
> "com.xyz.FrameworkManagerStub").createMessageFactory()>
>
> Hope this helps.
> Thanks
>        Mark
>
> -----Original Message-----
> From: Ankush Khurana [mailto:[EMAIL PROTECTED]
> Sent: Thursday, February 07, 2008 6:50 PM
> To: CF-Talk
> Subject: Java-Coldfusion conversion
>
> Hi,
> I have run into a huge issue and I need your help ASAP. I need to make
> the following JAVA code happen in CF.
>
> public static final String componentFile = "config/client.xml"; String[]
> compArgs = new String[1]; compArgs[0] = componentFile;
> FrameworkManager.main(compArgs); MessageFactory mf = (MessageFactory)
> FrameworkManager.getComponent(MessageFactory.ROLE);
>
> FrameworkManager and MessageFactory are being imported. they are in .JAR
> files provided by the customer. I just cannot get the "main" to  get
> executed, foget about moving forward.
>
> Can you help please?
>
> Thanks.
> Ankush
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:298581
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to