Barry Brown
Barry Brown

Reputation: 20604

Can Eclipse dynamically evaluate expressions?

In some Java IDEs (BlueJ and DrJava, for example), the user can open an interaction window where Java expressions and statements can be typed in. The IDE quickly compiles and runs the code, displaying the returned value if necessary.

In BlueJ, it's called the Code Pad. It's similar in spirit to the Interaction Pane in DrRacket/DrScheme.

Does something like this exist for Eclipse?

Upvotes: 9

Views: 6533

Answers (3)

Rayman Mann
Rayman Mann

Reputation: 1

I know this is a pretty big necro, but I came upon this page while searching for the answer myself. Unfortunately, none of the above answers led me to figuring out how to do what I wanted easily. I found out how to do what I wanted to and decided to post here incase someone else learning Java got stuck the same way we did.

The 'Interactions Panel' in DrJava for i.e. allows you to write 'run programName 1 2 3' and 1 2 3 are the inputs for args[0]->args[2] and the program will then be ran.

To do this easily in Eclipse, click on the Run tab -> Run Configurations... -> Arguments tab -> Program Arguments -> type '1 2 3'. This will run your program with 1 2 3 as your inputs for your arguments.

Cheers.

Upvotes: 0

Michael Brewer-Davis
Michael Brewer-Davis

Reputation: 14276

You may be looking for Scrapbook pages. Here's a write-up and here are other SO questions which talk about it.

Upvotes: 9

sbridges
sbridges

Reputation: 25150

There is also the Display View, which allows executing code while debugging. It's handy, because it evaluates in the context of the current stack frame.

Upvotes: 8

Related Questions