I have a Java server process that I normally run in either Windows batch file consoles or in Linux Bash script consoles. I manage these scripts independently of each other and I wish I had something that was cross platform, more powerful, and easier.
Besides running the java process itself, the scripts need to create files, configure files, read/write .xml config data, prepare databases, etc.
So, which scripting language would be the best for this that would allow the script to go cross platform?
Also, if you have heard of someone doing something similar to this, I would love a link to see the example.
I think Groovy would be a great choice. It’s syntax is very similar to Java, but it is much more concise (than Java), particularly for the kind of things you need to do in scripts. For example, here’s a Groovy script that reads the content of a file:
That’s it! There’s no need to put it inside a class or even compile it. Just put the text above in a file named
Script.groovyand invoke it from the command line usinggroovy Script.groovy.Also, because Groovy runs on the JVM there should be no cross-platform issues, and you’ll already have the necessary runtime installed on all the machines you need to run your scripts on.
Groovy comes with a console that you can use to quickly test out your scripts.