Take the 2-minute tour ×

I am making an interpreted language with java......and am also making an IDE for it. I want to know how to compile java source from my IDE and have it run on a console. I have created a simple console window. But how do i compile java source from my simple IDE and route its output to my console window?

The Interpreted language is interpreted by an interpreter i created and it then creates a java source that needs to be compiled.

share|improve this question
Too ambitious? I do not think that should be in ANY developers vocabulary... –  nicholas.hauschild Aug 15 '11 at 18:35
add comment

closed as not a real question by greyfade, bmargulies, Mrchief, Kev Aug 15 '11 at 20:01


2 Answers

You can use the JavaCompiler interface from the JDK. Read the linked documentation to get an elaborate example of how to use it.

As to running the resulting code, you use the Tool class.

In general: Check out the javax.tools package in the JVM.

share|improve this answer
add comment

Assuming you get the syntax right, you would want to compile it using javac . Now choosing which implementation of the JVM to use is another issue as not everything lines up so "nicely"

share|improve this answer
add comment
