File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes What do Most Java Programmer's Use for Scripting Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "What do Most Java Programmer Watch "What do Most Java Programmer New topic
Author

What do Most Java Programmer's Use for Scripting

Gary Furash
Greenhorn

Joined: Nov 03, 2010
Posts: 13
I realize this is not the wholly correct forum, but this seemed like the least worst place to post this.

For some of your daily activities, you will have work for which Java is innapropriate and ANT isn't the right tool, e.g., doing something with backup scripts, automation, etc.

What do most Java programmers in these cases use as a scripting language? Something "full-blown" like Python, or just bash shell. Just curious. It would seem odd to learn a large complex language just to do quick scripting tasks. Cross platform would be nice, but even Perl can turn out to be pretty complicated.

Thank's in advance.
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7699
    
  20

Gary Furash wrote:What do most Java programmers in these cases use as a scripting language? Something "full-blown" like Python, or just bash shell. Just curious. It would seem odd to learn a large complex language just to do quick scripting tasks

Bash for me; but then I'm an old Sysadmin. In fact it's one of the very few things that I'd say I'm an expert in after nearly 20 years, starting with Bourne; got me own toolkit and doc system to prove it.
And just to prove what a dinosaur I am, I'll p*ss off all the Perlies out there by saying that awk is the best thing I've ever come across for text mangling.

Winston


Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
Hunter McMillen
Ranch Hand

Joined: Mar 13, 2009
Posts: 492

Gary Furash wrote:What do most Java programmers in these cases use as a scripting language? Something "full-blown" like Python, or just bash shell. Just curious. It would seem odd to learn a large complex language just to do quick scripting tasks. Cross platform would be nice, but even Perl can turn out to be pretty complicated.


When I was trying to figure out what scripting language to use I tried a bunch of online tutorials to get a feel for the languages, I ended up really enjoying Ruby and use that almost everyday now; but there are plenty of other alternatives, ksh, bash, python, perl, lua. A ton of languages you can choose from.


Hunter


"If the facts don't fit the theory, get new facts" --Albert Einstein
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

bash


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Gary Furash
Greenhorn

Joined: Nov 03, 2010
Posts: 13
I'm sure that Ruby, Python, Perl, and any of the new desktop JavaScript solutions are great for scripting, but you can also use those for building Java-sized apps, which implies to me that learning them, while not hard, is kind of big and "endless", like Java. Things like the aformentioned Bash seem more like scripting solutions - limited, imperfect, but quick and easy. I would have put in Perl, but that thing has tens of thousands of models including OO. Thanks, I think I'll go with bash for now. With cygwin32, its crossplatform enough form me.

I wanted to use something like Beanshell or Groovy, but Beanshell isn't supported that well (the community just restarted) and Groovy is again its own thing, with non-java syntax.

Please correct me if I'm off here.
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

bash or zsh for me, depending on what's available on the particular system I'm on. Although I seem to recall an occasion or two where I found it handy to use groovy.
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Gary Furash wrote:Groovy is again its own thing, with non-java syntax.


As far as I know, although Groovy does have feature in the language that Java does not, everything that's legal Java syntax is also legal Groovy syntax. You can just plain ol' write Java and execute it via the Groovy interpreter. There are a couple of small caveats though. I think that == in Groovy calls equals(), and that you have to use the is() method for reference equality. Also, array syntax gets you a List (ArrayList, I would imagine) rather than a Java array, though there is a way to get an array as well I think.
Hunter McMillen
Ranch Hand

Joined: Mar 13, 2009
Posts: 492

keep in mind that even if the language is large like Python, Ruby, or Perl; you don't need to know everything about the language to write small scripts. You only need to focus on the subset of the language your task requires.

Hunter
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7699
    
  20

Gary Furash wrote:Thanks, I think I'll go with bash for now. With cygwin32, its crossplatform enough form me.
Please correct me if I'm off here.

Not at all. It has to be said, though, that comparing bash with something like Python or Ruby is a bit unfair. Many of the "scripts" that have been mentioned have fully-fledged "this is a language, goddammit!" forums (many with some justification), and some of them need a JVM to run on.
When I first used the Bourne shell, it fit in 64K; and the latest version of bash is still less than a meg; the average JVM is about 10, and although I'll bet that it's resident (what we used to call 'sticky') on most machines these days, it still takes a bit of priming.

Why do I like bash? Because it is Unix. There's really nothing that you can do outside it (except maybe some eeprom commands and scsi checks) that you can't do in it. And, especially post-Vista, it is not the same thing as the "command prompt" in Windows.

Winston
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: What do Most Java Programmer's Use for Scripting