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.

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. http://www.beanshell.org/). 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.

1  
Are you on a Mac? If yes then definitely check this application krillapps.com/coderunner –  Chiron Jan 20 '12 at 1:09
1  
drJava has a nice interactions pane to try –  Adel Jan 20 '12 at 1:11
4  
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
add comment

4 Answers

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
add comment

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
add comment

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
2  
+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
add comment

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
2  
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
add comment

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