How Compiler Reads Editor?

I'm just curious how the JDK reads the contents of the JCreator Editor Environment...Meaning..

int length=0;

..is read by the compiler as a integer variable length with 0..If

ever, is there a way for a programmer to throw a

string equation to the compiler....

string sample = "int length=0";

and process it the same way as it is read in a JCreator Environment..?

[408 byte] By [rapsysa] at [2007-9-28 2:44:04]
# 1

I imagine that JCreator is written in C/C++. It therefore runs a system call to the JDK, like : system("javac theFile.java"); javac then compiles the whole file at a time. (Probably launches a new thread, in linux it would be fork() or clone(), but in windows, I dont know.

As far as running just one line of code through the java compiler, I am not sure if you can do it. You can write it to a temporary java file and the use: Runtime.getRuntime().exec("javac temp.java");

Note that exec returns a process, you can then retrieve the different streams (input/output/error), to see there result of the compilation.

Hope it helps.

Thanks

Cardwell

cardwellcuppa at 2007-7-7 22:17:10 > top of Java-index,Other Topics,Algorithms...
# 2
Or just use the Compiler class (java.lang.Compiler).
rdoergaa at 2007-7-7 22:17:10 > top of Java-index,Other Topics,Algorithms...