Click to See Complete Forum and Search --> : Java interpreter in Java


ariels
April 18th, 2010, 02:25 PM
Hi all,

I need to write a simple Java applet that can receive java code,interpret it and display the output. Is there any Java package for Java-interpretation I can use in my applet to do that?

thanks in advance,
ArielS

Xeel
April 19th, 2010, 04:13 PM
a simple Java applet that can receive java code,interpret it and display the output
- Just read the String/file with Java code and print it out in applet;
- Adding word "simple" won't make the task such, code parsers are never simple;

ariels
April 20th, 2010, 01:38 AM
I know parsing code, especially for a rich language such as Java ,is more than just a simple task. What I meant was I want to write an applet that all it does is receives code from the user by String / File, uses some existing (hopefully) Java-interpretation tool and displays the output of the given code. My hope is that such package exists, with some static methods allowing me to do something like:

String code = ...
String output = JavaInterpreter.interpret(code);

(And maybe throws exceptions when the code has problems).
I don't understand your first point: "Just read the String/file with Java code and print it out in applet" - how exactly can it help me achieve my goal?