views:

2157

answers:

3

I have to ship some groovy code to some users that have only java installed (no grooy, no $groovy_home, etc). I'm trying to invoke groovy from the commandline but I'm having no luck. Here's my bat file:

java -classpath .;lib;bin;bin-groovy introspector.AclCollector

And here's my exception:

Exception in thread "main" java.lang.NoClassDefFoundError: groovy/lang/GroovyObject
       at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
        at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Caused by: java.lang.ClassNotFoundException: groovy.lang.GroovyObject
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
        ... 12 more
Could not find the main class: introspector.AclCollector.  Program will exit.

Does anyone have a clue? I have 'groovy-all-1.6-beta-1.jar' in \lib dir.

+6  A: 

I think you need to explicitly list the groovy jar in the classpath

frankodwyer
+8  A: 

You have here another example of Groovy app called from Java (in this case, from ant, but the general idea is the same).

java -cp [...];%GROOVY_HOME%/embeddable/groovy-all-1.5.4.jar;[..]

As mentioned by frankowyer, you have the exact groovy jar explicitly listed on the classpath arguments of the java.

Since your clients do not have special environment variable, just replace the %GROOVY_HOME%/... with the complete path to:

VonC
A: 

i can't open my icq account because ther is general error (0x80070057)and stack overflow ai line 307

tharwat ayad