Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I'm coding in Python and I want to try something out, I open IDLE of Python on the command line and am able to quickly try something out. Is there a similar way I could do that for Java?

I have heard about Java "shells" (e.g. Has anyone tried them?

share|improve this question

closed as off topic by Mark Trapp Jan 20 '12 at 7:25

Questions on Programmers Stack Exchange are expected to relate to software development within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

Are you on a Mac? If yes then definitely check this application – Chiron Jan 20 '12 at 1:09
drJava has a nice interactions pane to try – Adel Jan 20 '12 at 1:11
Possible duplicate of this stackoverflow question. Wouldn't a Smalltalk-like workspace be nice in Java though? ;-) – Amos M. Carpenter Jan 20 '12 at 5:12
Hi rdasxy, questions about development tools, including recommendations for specific tasks, are off-topic here: for that, you want our sister site, Stack Overflow. However, check out the link aaamos gave before attempting to reask there. – user8 Jan 20 '12 at 7:26 allows running java code snippets and viewing the results in a nice GUI – Ryan Hamilton Feb 4 at 10:18
up vote 5 down vote accepted

Groovy is perhaps better suited to your needs. As wikipedia notes, "Most Java code is also syntactically valid Groovy."

Here's an example of a Groovy web console

share|improve this answer

If you download the free BlueJ IDE you can use the code pad area to try out snippets of code on the fly.

BlueJ Code Pad

share|improve this answer
+1 for BlueJ. Reminds me of being a 'fresher in Uni. – blahman Jan 20 '12 at 3:03

If you have Eclipse open and a program in debug I like to use the Display window to quickly test out Java code snippets real time. If I am not debugging something I generally just code snippets into a JUnit test case and run them to see what happens.

I know it is not the best way but it is often good enough for my needs.

share|improve this answer
+1 It might miss some notoriety, but the Display window is very useful to prototype dynamically some code. I use it often at debug time. It is very similar to the Immediate window for the people familiar to the VB / VBA IDE. – Seki Jan 20 '12 at 9:26

I'd use ideone. Offers many languages, including Java.

ideone is something more than a pastebin; it's an online compiler and debugging tool which allows to compile and run code online in more than 40 programming languages...

Choose a programming language, enter your source code and input data into text boxes. Then check or uncheck run code (whether to execute your program) and private (whether not to list your code in the recent codes page) checkboxes, click the submit button and watch your snippet being executed...

share|improve this answer
It isn't really a time saver IMHO. – Chiron Jan 20 '12 at 1:26
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – Jalayn Aug 17 '12 at 12:51

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