Is there something like python\'s interactive REPL mode, but for Java?
So that I can, for example, type InetAddress.getAllByName( localHostName )
in a window, a
For folks with access to Mathematica, JLink lets you access Java and script with Mathematica code:
Needs["JLink`"]
LoadJavaClass["java.net.InetAddress"]
InetAddress`getAllByName["localhost"]
Hit Shift-Enter to evaluate, and you get
{<<JavaObject[java.net.Inet4Address>>}
Then you can use Mathematica's Map function to call toString
on the returned objects:
#@toString[]& /@ %
to get the result (or to use the less obscure syntax, Map[Function[obj, obj@toString[]], %]
):
{"localhost/127.0.0.1"}
If you start to get serious with this, you'll want to read Todd Gayley's tutorial at http://reference.wolfram.com/mathematica/JLink/tutorial/Overview.html.
You could take a look at BlueJ which is an interactive Java development environment meant for teaching OOP rather than as full IDE like Eclipse or NetBeans. It's kind of fun to have a play with anyway.
You can see it in action on YouTube in a series of Java tutorials.
JPad is a java scratchpad with a builtin REPL:
C:\>jpad
_ _____ _
| | __ \ | |
| | |__) |_ _ __| |
_ | | ___/ _` |/ _` |
| |__| | | | (_| | (_| |
\____/|_| \__,_|\__,_|
Anything you type is evaluated as java.
The code is continuously appended until you call \clear.
Other Available Commands:
\exit - exit
\clear (n) - clear past java statements
\history - display all past java statements
\help - display this help
j>2+2
4
j>Math.sin(100.1)
-0.4177477
j>
It is also smart about dumping collections, lists, maps etc and allows rendering them as a table or chart:
You can use Eclipse Scrapbook pages.
In Eclipse create a Scrapbook page. In your project, New->Other->Scrapbook page.
In the file, enter some text, select it and hit ctrl-U, and there you go.
To manage your imports, right click in the page and select Set Imports, where you can choose to import a package or a single class. This is persistent, and is saved with the page.