calling .net

View: New views
3 Messages — Rating Filter:   Alert me  

calling .net

by grkuntzmd :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am trying to run the example of calling the .net framework from Groovy.

Here is my Groovy code (saved in callcli.groovy and compiled with groovyc):

#!/usr/bin/env groovy

cli.System.Console.WriteLine('hello world')

I ran the following comand:

ikvm -cp '.;C:\Groovy\embeddable\groovy-all-1.5.6.jar' callcli

and got the following error:

Exception in thread "main" groovy.lang.MissingPropertyException: No such property: cli for class: callcli
        at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50)
        at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.getGroovyObjectProperty(ScriptBytecodeAdapter.java:537)
        at callcli.run(callcli.groovy:3)
        at java.lang.reflect.Method.invoke(Method.java:625)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:230)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:912)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:756)
        at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:778)
        at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:758)
        at org.codehaus.groovy.runtime.InvokerHelper.runScript(InvokerHelper.java:401)
        at java.lang.reflect.Method.invoke(Method.java:625)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:230)
        at groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1105)
        at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:758)
        at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:170)
        at callcli.main(callcli.groovy)

What are the actual steps to make this work?

Thanks, Ralph

G. Ralph Kuntz, MD

Re: calling .net

by Tom Nichols :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You are probably missing an import statement?  Either that or the ikvm
library that contains the 'cli' package isn't in the classpath.  Can
you run a comparable version in a Java main method?

On Fri, Aug 22, 2008 at 12:59 PM, grkuntzmd <grk@...> wrote:

> I am trying to run the example of calling the .net framework from Groovy.
>
> Here is my Groovy code (saved in callcli.groovy and compiled with groovyc):
>
> #!/usr/bin/env groovy
>
> cli.System.Console.WriteLine('hello world')
>
> I ran the following comand:
>
> ikvm -cp '.;C:\Groovy\embeddable\groovy-all-1.5.6.jar' callcli
>
> and got the following error:
>
> Exception in thread "main" groovy.lang.MissingPropertyException: No such
> property: cli for class: callcli
>         at
> org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50)
>         at
> org.codehaus.groovy.runtime.ScriptBytecodeAdapter.getGroovyObjectProperty(ScriptBytecodeAdapter.java:537)
>         at callcli.run(callcli.groovy:3)
>         at java.lang.reflect.Method.invoke(Method.java:625)
>         at
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
>         at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:230)
>         at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:912)
>         at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:756)
>         at
> org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:778)
>         at
> org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:758)
>         at
> org.codehaus.groovy.runtime.InvokerHelper.runScript(InvokerHelper.java:401)
>         at java.lang.reflect.Method.invoke(Method.java:625)
>         at
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
>         at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:230)
>         at
> groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1105)
>         at
> org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:758)
>         at
> org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:170)
>         at callcli.main(callcli.groovy)
>
> What are the actual steps to make this work?
>
> Thanks, Ralph
>
> G. Ralph Kuntz, MD
> Chief Software Architect
> meridianEMR, Inc.
> ________________________________
> View this message in context: calling .net
> Sent from the groovy - user mailing list archive at Nabble.com.
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: calling .net

by grkuntzmd :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The distance between my fingers and my keyboard is shorter than the distance between my fingers and my brain :-).

I should have read the instructions at ikvm.net before posting.

Everything working well now.

Thanks.
G. Ralph Kuntz, MD