Reading a file line by line and executing the code

I need to read a file line by line and execute them simultaneously.I use BufferedReader for reading , but for executing i tried a lot , but could not find a solution.Kindly help and try to brief me.
[219 byte] By [gulura] at [2007-10-3 6:02:37]
# 1
What do you mean "execute them simultaneously"?
jverda at 2007-7-15 0:44:51 > top of Java-index,Java Essentials,Java Programming...
# 2
What exactly do you mean by "executing" the code.
camickra at 2007-7-15 0:44:51 > top of Java-index,Java Essentials,Java Programming...
# 3

If you're hoping to execute lines of java source code on the fly...then forget it. Java is a compiled language. It doesn't have an "eval" statement like other languages.

Now, you can write an interpreter for a language in Java. And I suppose you could write an interpreter for Java in Java (although at that point, you might as well choose to interpret a different language; it would probably be easier). But that would be a pretty big task.

paulcwa at 2007-7-15 0:44:51 > top of Java-index,Java Essentials,Java Programming...
# 4
a.bsh contentsline1:import .........*;line2:new a.method();......line x:new a.method();Now i need to read a.bsh .This should be run in command line modeI read the first line , execute it in Runtime.
gulura at 2007-7-15 0:44:51 > top of Java-index,Java Essentials,Java Programming...
# 5
> Now i need to read a.bsh .This should be run in> command line mode> I read the first line , execute it in Runtime.So you're talking beanshell, right?Well, look at beanshell's API docs.
jverda at 2007-7-15 0:44:51 > top of Java-index,Java Essentials,Java Programming...
# 6
bean shell is just an interface , so i think that will not affect this operation.
gulura at 2007-7-15 0:44:51 > top of Java-index,Java Essentials,Java Programming...
# 7

beanshell has a libaray that you can use in your Java code. You can pass Java statements (well, probably beanshell statements, which would be a superset--or nearly one--of Java statements) to be executed.

The "interface" you speak of--by which I assume you mean the interactive interpreter--is just a Java program that uses that API.

jverda at 2007-7-15 0:44:51 > top of Java-index,Java Essentials,Java Programming...
# 8
thanks jverd
gulura at 2007-7-15 0:44:51 > top of Java-index,Java Essentials,Java Programming...