Page 1 of 1

Groovy on z/OS

Posted: Wed Nov 15, 2006 5:37 am
by DaveThePom
Has anybody managed to get Groovy installed on a z/OS system. I downloaded the source and the package is built using Maven. I then downloaded maven but when I ran pax it failed due to @LongLink references that pax couldn't handle.

I suppose I could manually go through the maven build process but that seems like a lot of work!

Groovy is shaping up to be a fantastic language. I think it would be a fantastic addition to z/OS.

Posted: Wed Nov 15, 2006 7:51 am
by SteveGoetze
I'm not aware that this has been done, but I think it would be great if someone spent some time on it.

Posted: Wed Nov 15, 2006 8:28 am
by DaveThePom
I'm more than willing to give it a crack. Any advice on how to get a quick start is more than welcome.

Posted: Wed Nov 15, 2006 4:22 pm
by SteveGoetze
I've installed groovy-1.0-JSR-06 on z/OS and performed some rudimentary testing, running groovysh and compiling and running a groovy script. Please feel free to pick up from here and do some more testing.

If problems crop up, they will almost certainly be related to character encoding. If you see any, pass them on and we'll see if we can get them addressed.

Installation steps:

Get the .zip version of the latest build:
From a z/OS shell:

Code: Select all

jar -xvf
ln -s groovy
cd groovy
for i in bin/*; do; iconv -f iso8859-1 -t ibm-1047 $i > $i.e; mv $i.e $i; done
for i in conf/*; do; iconv -f iso8859-1 -t ibm-1047 $i > $i.e; mv $i.e $i; done
chmod +x bin/*
Export a GROOVY_HOME environment variable
Add GROOVY_HOME/bin to your PATH
Ensure that JAVA_HOME is set to point to an installed JDK

To run a groovy shell:

Code: Select all

To compile and run a script, create the file "hello.groovy":

Code: Select all

println "hello, world"
for (arg in this.args ) {
  println "Argument:" + arg;
Then compile and run:

Code: Select all

groovy test.groovy foo bar baz

Posted: Thu Nov 16, 2006 5:40 am
by DaveThePom
Thanks Steve, very much appreciated.

I've started to run some unit tests, no problems so far. The load time is slow, but I expected that. Curiously, when I run groovy from the OMVS shell, no output is written until I press enter. If I telnet in, everything is fine.

Posted: Thu Nov 16, 2006 8:30 am
by SteveGoetze
groovy loads a lot of java to get started. If you have the 5.0 SDK on z/OS, you can use the shared classes feature to get better startup performance.

Code: Select all

export JAVA_OPTS="-Xshareclasses"
You should see an improvement in startup times after the first groovy run. Note that this feature is not available under the 1.4 SDK.

Posted: Fri Nov 17, 2006 7:54 am
by DaveThePom
Thanks for the tip. I didn't notice a big difference with groovy, but it's certainly noticeable when running Java programs.

I'm trying to run the following soap samples which results in an error. I don't know if this is due to character encoding, but it runs ok on XP.

Code: Select all


def server = new SoapServer("localhost", 6980)



Caught: groovy.lang.GroovyRuntimeException: Could not find matching constructor for: SoapServer(java.lang.String, java.lang.Integer)
        at SoapServer.main(SoapServer.groovy)
BTW, your help is much appreciated. If you ever find yourself in Western Australia I'll shout you a few beers ;).