jastrachan | 16 Apr 17:08 2004
Picon

Re: compiled by groovyc not accessable?

On 16 Apr 2004, at 15:58, postmaster@... wrote:
>> On 16 Apr 2004, at 15:44, alex@... wrote:
>>> Hi,
>>>
>>> Trying to get things going with Groovy:
>>>
>>> When I create a 'normal' java class, export it to a jar file add this
>>> to my ~/.groovy/lib
>>> dir, I can acces it via the shell or another script.
>>>
>>> However, I created a class, the groovy way, running it as groovy
>>> myclass.groovy works
>>> fine, groovyc compiles alright and then added it to a jar with
>>> "java cvf wojo.jar  myclass.class" and added the jar to the groovy 
>>> lib.
>>>
>>> Now when I run the script where I imported my class, I get a
>>> NoClassDefFoundError.
>>
>> so myclass.class is definitely in the jar right? And you're trying to
>> run it how?
>>
>> java -cp wojo.jar myclass
>
> 1. created a KBReader.groovy file (reads input from Keyboard) (package 
> wojo)
> 2. tested it with "groovy KBReader.groovy" -> worked
> 3. compiled with "groovyc KBReader.groovy"  -> no errors
> 4. 'jarr-ed it' with "jar cvf wojo.jar wojo/KBReader.class" -> no 
> errors
> 5. copied wojo.jar to ~/.groovy/lib
> 6. created test.groovy file:
>  import wojo

you need to import a class - so this import statement is meaningless. 
But then you're using fully qualified names anyways...

>  # KBReader has only one static method getInput
>  result = wojo.KBReader.getInput("enter value")

Whats the error?

James
-------
http://radio.weblogs.com/0112098/

Gmane