Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Justed stumbled across CRaSH and although it looks mighty interesting, I'm wondering why a Java developer should invest time & energy into learning (yet another) shell language. What sort of standard- and cool-applications can CRaSH be used for? Is this like a Groovy-version of Jython?

I guess, when the dust settles, I'm looking for CRaSH's "wow" factors. I'm sure they're there, but after spending ~20 minutes perusing the documentation I'm just not seeing them. Thanks in advance!

share|improve this question
It is just another implementation of a very old trick. I've been embedding debugging/prototyping shells into my applications ever since Fortran. Any scripting language with a REPL would be sufficient (I actually used Jython this way, as well as Iron Python for .NET). –  SK-logic Jul 4 '12 at 10:53
add comment

1 Answer

up vote 4 down vote accepted

Possible Uses

Fast Prototyping

You could do this with Groovy or others, so that's not a very strong point, but as CRaSH gives you code-level access to the JVM and the processes it runs, it may come in handy to just keep a JVM running and experiment with small code snippets (for instance, using it as a REPL to implement solutions to StackOverflow questions).

The JCR extension would seem potentially useful to supplement this, by giving you shell access to remote repositories, and contains a notion of workspace to separate projects.

Interacting with a Running Process

I could see this being an interesting use case. I don't know of many good process inspection command-line tools for JVM processes, apart from the JDK-packaged ones. CRaSH might help in interacting with them in novel ways.

For instance, you can use the Attach Mode to attach to a running JVM, and then use the thread command to ls, dump or interrupt threads.

You could also write some additional control commands for non-programmers to use CRaSH to perform routine maintenance and monitoring.

Content Repository Management

The JCR extension seems to be very interesting as well, as it would give a Java-scriptable access to remote development environments. It could also simply allow content-editors to access and edit remote content, when used in the context of CMS-type apps built on top of a JCR-capable content repository.

What Others Say About CRaSH


Basically, I see it as a power-user or administrator interface to JVM processes, built on top of Groovy and networking protocols. So it combines the power of scripting with a nice facade and some built-in connectors.

Note on Flexibility

I agree with SK-logic: most of this can be done with most JVM-languages, and they provide more and flexibility. But CRaSH might provide a shorter path to achieving such goals.

The same applies to the JCR extension capabilities: you can achieve this by glueing together a few age-old and time-tested tools. But this might be a shorter and simpler path (like commands for the heroku platform, or PaaS services, for instance).

share|improve this answer
You can use any scripting language with a REPL for debugging a running process. Of course you have to plug your own telnet/ssh listener there. –  SK-logic Jul 4 '12 at 10:54
@SK-logic: you can, but you would need to code in some of the actions. Whereas here it seems like CRaSH attempts to already give you some control, treating the JVM as a system (which it is) to allow you to nagivate it and query and update its properties. To me that seems potentially interesting. I haven't tried it yet, but probably will soon-ish. –  haylem Jul 4 '12 at 10:59
in Jython you can instantiate any JVM class, call any method, etc. - just same as in this shell. It is interesting, yes, but not unique. –  SK-logic Jul 4 '12 at 11:32
@SK-logic: nobody said it was unique either. And I know you can instantiate objects with Jython (or JRuby, or Groovy, or Clojure, or Scala, ...), but the point is that it's a programming activity. It's totally different than from giving a user interface to people that may not be programmers, or who may not want to have to type in code, but just simpler, more familiar commands. I think you see this too much from the eye of a developer. –  haylem Jul 4 '12 at 12:16
@haylem - thanks (+1)! However, your answer is just a little too vague for me to give it the final green check. Can you please clarify a few things: (1) what do you mean (specifically) by "fast prototyping"? And (2) What JVM properties can you modify while it is running? Can you list 2 or 3 specific use cases here - where a CRSH scripter would do such a thing, and why? I'm just having a problem "seeing the forest through the trees." Thanks again! –  herpylderp Jul 4 '12 at 12:50
show 1 more comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.