Java
Grant Robinson
santiago at mr-r.net
Tue Feb 13 19:22:37 MST 2007
On Feb 13, 2007, at 1:34 PM, Bryan Sant wrote:
> On 2/13/07, Daniel C. <dcrookston at gmail.com> wrote:
>> You're right. I don't know of a single Java IDE that has an REPL
>> built into it.
>
> Other than all of them. Both the "Display" and "Expressions" view in
> Eclipse do what you want. You must be running in debug mode for it to
> work (because a JVM must be running to do the live evals).
Now you've piqued my curiosity.
So, I can cut and paste the following in Eclipse in one or both of
these views:
-- BEGIN PASTE SECTION
public class NewClassWithNoAssociatedSourceFile {
public String member1;
public NewClassWithNoAssociatedSourceFile() {
member1 = "hello";
}
}
NewClassWithNoAssociatedSourceFile myclass = new
NewClassWithNoAssociatedSourceFile();
System.out.println(myclass.member1);
-- END PASTE SECTION
Now, what if I want to do that on the fly in one of my classes? Or,
what if I want to add a new member function to a class by calling a
method in another class? What if I want to create a new class based
on user input at runtime? Or add methods to an existing class based
on user input, also at runtime? Can I do those things in Java? If
so, is it built into the language or do you need to install something
extra?
Grant
More information about the PLUG
mailing list