How to write a Java application that creates another Java file?
2,207 viewsA few months ago I was trying to write a simple application that could write another java file on its own. While it works, the implementation is really basic.
Here’s the pdf with my code that i created somewhere in march: http://engineeringserver.com/Software/3%20-%20CreateClass.pdf
This class can be used as a reference to create a more sophisticated application that in turn created another java file depending on the user input.
This version doesn’t make use of the compiler api provided by sun because I didn’t knew it was available until I read about it recently 73-the-java-60-compiler-api-1 but in my next version i’ll make a significant change in the current code so that it makes full use of the Java 6.0 Compiler API.
Until then, have fun with my old code but expect a new and improved version soon.
[update]
Download link: http://www.freefilehost.co.uk/530174
Password: engineeringserver.com

(2 votes, average: 4.5 out of 5)











November 21st, 2008 at 12:23 am
[...] Java 1.6 was released to the public I used the Runtime class (found in java.lang) to call the java compiler (javac.exe) directly to compile a Java file from [...]